asp 如何作出走势图

xygxyg 2004-08-11 08:18:17
我想用asp一个走势图,可以按照不同的时间段查询出不同的走势来,不知道用那种控件,有是如何调用的,谢谢
...全文
174 点赞 收藏 14
写回复
14 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
eliphe 2004-11-23
ibqsChart统计图表组件

http://www.ibqs.com/U_View_xzzx_detail.asp?CID=8
回复
poron9 2004-11-23
VML
回复
catwg77 2004-11-23
http://scripts.sportscn.com/odds/odds_aomen.php3?matchid=128614

敢问这种格式(jpg)的的走势图如何弄的
回复
runmin 2004-08-11
http://runmin.europe.webmatrixhosting.net/drawline.htm
回复
yyyjff 2004-08-11
狂顶啊。。。
回复
bladewing 2004-08-11
用OWC吧
回复
xeimm 2004-08-11


for(var i=0;i<total_no-1;i++)
{
document.write("<v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x + left_width + all_width * (i)/(total_no-1)) + "px," + (table_y + all_height) + "px' to='" + (table_x + left_width + all_width * (i)/(total_no-1)) + "px," + (table_y + all_height + 15) + "px'/>");
document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + (table_x + left_width + all_width * (i)/(total_no-1)) + "px;top:" + (table_y + all_height) + "px;width:" + (all_width/(total_no-1)) + "px;height:18px;z-index:1'>");
document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>" + total[0][i] + "</td></tr></table></v:textbox></v:shape>");
}

var tb_height = 30
document.write("<v:rect id='_x0000_s1025' style='position:absolute;left:" + (table_x + all_width + 20) + "px;top:" + table_y + "px;width:100px;height:" + (line_no * tb_height + 20) + "px;z-index:1'/>");
for(var i=0;i<line_no;i++)
{
document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + (table_x + all_width + 25) + "px;top:" + (table_y + 10+(i) * tb_height) + "px;width:60px;height:" + tb_height + "px;z-index:1'>");
document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>" + line_code[i][4] + "</td></tr></table></v:textbox></v:shape>");
document.write("<v:rect id='_x0000_s1040' alt='' style='position:absolute;left:" + (table_x + all_width + 80) + "px;top:" + (table_y + 10+(i) * tb_height + 4) + "px;width:30px;height:20px;z-index:1' fillcolor='" + line_code[i][0] + "'><v:fill color2='" + line_code[i][0] + "' rotate='t' focus='100%' type='gradient'/></v:rect>");
}
}
</script>

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<!--[if !mso]>
<style>
v\:* { behavior: url(#default#VML) }
o\:* { behavior: url(#default#VML) }
.shape { behavior: url(#default#VML) }
</style>
<![endif]-->

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<style>
TD { FONT-SIZE: 9pt}
</style></head>
<body topmargin=5 leftmargin=0 scroll=AUTO>
<script language=javascript>

var nameArray = new Array();

nameArray[0]="中国经营报"
nameArray[1]="招聘网"
nameArray[2]="51Job"
nameArray[3]="新民晚报"
nameArray[4]="新闻晚报"
nameArray[5]="南方周末"
nameArray[6]="羊城晚报"

var dataArray1 = new Array()

dataArray1[0]="#FF0000,1.5,1,2,公司1"//参数1线条的颜色,参数2线条的宽度,参数3线条的类型,参数4转折点的类型,参数5线条名称
dataArray1[1]=200
dataArray1[2]=1200
dataArray1[3]=900
dataArray1[4]=600
dataArray1[5]=1222
dataArray1[6]=413
dataArray1[7]=800

var dataArray2 = new Array()

dataArray2[0]="#0000FF,1,2,3,公司2"
dataArray2[1]=400
dataArray2[2]=500
dataArray2[3]=1040
dataArray2[4]=1600
dataArray2[5]=522
dataArray2[6]=813
dataArray2[7]=980

var dataArray3 = new Array()

dataArray3[0]="#004D00,1,1,3,公司3"
dataArray3[1]=900
dataArray3[2]=890
dataArray3[3]=1240
dataArray3[4]=1300
dataArray3[5]=722
dataArray3[6]=833
dataArray3[7]=1280

var total = new Array(nameArray,dataArray1,dataArray2,dataArray3)

table2(total,100,90,600,250,3);
</script>
</body>
</html>
回复
xeimm 2004-08-11
折线图

<script language=javascript>

function table2(total,table_x,table_y,all_width,all_height,line_no)
{

//参数含义(传递的数组,横坐标,纵坐标,图表的宽度,图表的高度,折线条数)
//纯ASP代码生成图表函数2——折线图
//作者:龚鸣(Passwordgm) QQ:25968152 MSN:passwordgm@sina.com Email:passwordgm@sina.com
//本人非常愿意和ASP,VML,FLASH的爱好者在HTTP://topclouds.126.com进行交流和探讨
//版本1.0 最后修改日期 2003-8-11
//非常感谢您使用这个函数,请您使用和转载时保留版权信息,这是对作者工作的最好的尊重。

//***************************************************************************************
//修改说明:
// 本代码经原作者同意,由 awaysrain(绝对零度)修改为javascript。
// 最后修改日期 2003-9-22,测试环境为IE 6.0.2500.1106
// 因本人水平有限,修改中难免有错误,请大家及时指正。
//***************************************************************************************

var line_color = "#69f";
var left_width = 70;
var total_no = total[1].length

var temp1,temp2,temp3
temp1 = 0;
for(var i=1;i<total_no;i++)
{
for(var j=1;j<=line_no;j++)
{
if(temp1<total[j][i])
temp1 = total[j][i];
}
}

temp1 = parseInt(temp1);
if(temp1>9)
{
temp2 = temp1.toString().substr(1,1);
if(temp2>4)
{
temp3 = (parseInt(temp1/(Math.pow(10,(temp1.toString().length-1))))+1)*Math.pow(10,(temp1.toString().length-1));
}
else
{
temp3 = (praseInt(temp1/(Math.pow(10,(temp1.toString().length-1))))+0.5)*Math.pow(10,(temp1.toString().length-1))
}
}
else
{
if(temp1>4)
{
emp3 = 10;
}
else
{
temp3 = 5;
}
}
temp4 = temp3;

document.write("<v:rect id='_x0000_s1027' alt='' style='position:absolute;left:" + (table_x + left_width) + "px;top:" + table_y + "px;width:" + all_width + "px;height:" + all_height + "px;z-index:-1' fillcolor='#9cf' stroked='f'><v:fill rotate='t' angle='-45' focus='100%' type='gradient'/></v:rect>");

for(var i=0;i<all_height;i += all_height/5)
{
document.write("<v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x + left_width + length) + "px," + (table_y + all_height - length - i) + "px' to='" + (table_x + all_width + left_width) + "px," + (table_y + all_height - length - i) + "px' strokecolor='" + line_color + "'/>");
document.write("<v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x + (left_width - 15)) + "px," + (table_y + i) + "px' to='" + (table_x + left_width) + "px," + (table_y + i) + "px'/>");
document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + table_x + "px;top:" + (table_y + i) + "px;width:" + left_width + "px;height:18px;z-index:1'>");
document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='right'>" + temp4 + "</td></tr></table></v:textbox></v:shape>");
temp4 = temp4 - temp3/5;
}

document.write("<v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x + left_width) + "px," + (table_y + all_height) + "px' to='" + (table_x + all_width + left_width) + "px," + (table_y + all_height) + "px'/>");
document.write("<v:line id='_x0000_s1027' alt='' style='position:absolute;left:0;text-align:left;top:0;flip:y;z-index:-1' from='" + (table_x + left_width) + "px," + table_y + "px' to='" + (table_x + left_width) + "px," + (table_y + all_height) + "px'/>");

var tmpStr = ""
for(i=1;i<=line_no;i++)
{
var re = /,/g;
tmpStr += ",[\"" + total[i][0].replace(re,"\",\"") + "\"]"
}
tmpStr = tmpStr.substr(1,tmpStr.length-1)
var line_code = eval("new Array(" + tmpStr + ")")
for(var j=1;j<=line_no;j++)
{
for(var i=1;i<total_no-1;i++)
{
var x1 = table_x + left_width + all_width * (i - 1)/(total_no-1)
var y1 = table_y + (temp3 - total[j][i]) * (all_height/temp3)
var x2 = table_x + left_width + all_width * i/(total_no-1)
var y2 = table_y + (temp3 - total[j][i+1]) * (all_height/temp3)

document.write("<v:line id='_x0000_s1025' alt='' style='position:absolute;left:0;text-align:left;top:0;z-index:1' from='" + x1 + "px," + y1 + "px' to='" + x2 + "px," + y2 + "px' coordsize='21600,21600' strokecolor='" + line_code[j-1][0] + "' strokeweight='" + line_code[j-1][1] + "'>");

switch (parseInt(line_code[j-1][2]))
{
case 1:
break;
case 2:
document.write("<v:stroke dashstyle='1 1'/>");
break;
case 3:
document.write("<v:stroke dashstyle='dash'/>");
break;
case 4:
document.write("<v:stroke dashstyle='dashDot'/>");
break;
case 5:
document.write("<v:stroke dashstyle='longDash'/>");
break;
case 6:
document.write("<v:stroke dashstyle='longDashDot'/>");
break;
case 7:
document.write("<v:stroke dashstyle='longDashDotDot'/>");
break;
}

document.write("</v:line>");

switch (parseInt(line_code[j-1][3]))
{
case 1:
break;
case 2:
document.write("<v:rect id='_x0000_s1027' style='position:absolute;left:" + (x1 - 2) + "px;top:" + (y1 - 2) + "px;width:4px;height:4px; z-index:2' fillcolor='" + line_code[j-1][0] + "' strokecolor='" + line_code[j-1][0] + "'/>");
break;
case 3:
document.write("<v:oval id='_x0000_s1026' style='position:absolute;left:" + (x1 - 2) + "px;top:" + (y1 - 2) + "px;width:4px;height:4px;z-index:1' fillcolor='" + line_code[j-1][0] + "' strokecolor='" + line_code[j-1][0] + "'/>");
break;
}

}
switch (parseInt(line_code[j-1][3]))
{
case 1:
break;
case 2:
document.write("<v:rect id='_x0000_s1027' style='position:absolute;left:" + (x2 - 2) + "px;top:" + (y2 - 2) + "px;width:4px;height:4px; z-index:2' fillcolor='" + line_code[j-1][0] + "' strokecolor='" + line_code[j-1][0] + "'/>");
break;
case 3:
document.write("<v:oval id='_x0000_s1026' style='position:absolute;left:" + (x2 - 2) + "px;top:" + (y2 - 2) + "px;width:4px;height:4px;z-index:1' fillcolor='" + line_code[j-1][0] + "' strokecolor='" + line_code[j-1][0] + "'/>");
break;
}
}
回复
xeimm 2004-08-11
以前收集的

<script language=javascript>
function table3(total,table_x,table_y,all_width,all_height,table_type)
{
//参数含义(传递的数组,横坐标,纵坐标,图表的宽度,图表的高度,图表的类型)
//纯ASP代码生成图表函数3——饼图
//作者:龚鸣(Passwordgm) QQ:25968152 MSN:passwordgm@sina.com Email:passwordgm@sina.com
//本人非常愿意和ASP,VML,FLASH的爱好者在HTTP://topclouds.126.com进行交流和探讨
//版本1.0 最后修改日期 2003-8-11
//非常感谢您使用这个函数,请您使用和转载时保留版权信息,这是对作者工作的最好的尊重。

//***************************************************************************************
//修改说明:
// 本代码经原作者同意,由 awaysrain(绝对零度)修改为javascript。
// 最后修改日期 2003-9-22,测试环境为IE 6.0.2500.1106
// 因本人水平有限,修改中难免有错误,请大家及时指正。
//***************************************************************************************

var tmdColor1 = new Array();

tmdColor1[0] = "#d1ffd1";
tmdColor1[1] = "#ffbbbb";
tmdColor1[2] = "#ffe3bb";
tmdColor1[3] = "#cff4f3";
tmdColor1[4] = "#d9d9e5";
tmdColor1[5] = "#ffc7ab";
tmdColor1[6] = "#ecffb7";

var tmdColor2 = new Array();

tmdColor2[0] = "#00ff00";
tmdColor2[1] = "#ff0000";
tmdColor2[2] = "#ff9900";
tmdColor2[3] = "#33cccc";
tmdColor2[4] = "#666699";
tmdColor2[5] = "#993300";
tmdColor2[6] = "#99cc00";

var tb_color = new Array(tmdColor1,tmdColor2);
var tb_height = 30;
var total_no = total[0].length;
var totalpie = 0;
for(var i=0;i<total_no;i++)
{
totalpie += total[1][i];
}
var PreAngle = 0;
for(var i=0;i<total_no;i++)
{
document.write("<v:shape id='_x0000_s1025' alt='' style='position:absolute;left:" + table_x + "px;top:" + table_y + "px;width:" + all_width + "px;height:" + all_height + "px;z-index:1' coordsize='1500,1400' o:spt='100' adj='0,,0' path='m750,700ae750,700,750,700," + parseInt(23592960*PreAngle) + "," + parseInt(23592960*total[1][i]/totalpie) + "xe' fillcolor='" + tb_color[0][i] + "' strokecolor='#FFFFFF'><v:fill color2='" + tb_color[1][i] + "' rotate='t' focus='100%' type='gradient'/><v:stroke joinstyle='round'/><v:formulas/><v:path o:connecttype='segments'/></v:shape>");
PreAngle += total[1][i] / totalpie;
}

if(table_type=="A")
{
document.write("<v:rect id='_x0000_s1025' style='position:absolute;left:" + (table_x + all_width + 20) + "px;top:" + (table_y + 20) + "px;width:100px;height:" + (total_no * tb_height + 20) + "px;z-index:1'/>");
for(var i=0;i<total_no;i++)
{
document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + (table_x + all_width + 25) + "px;top:" + (table_y+30+(i)*tb_height) + "px;width:60px;height:" + tb_height + "px;z-index:1'>");
document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>" + total[0][i] + "</td></tr></table></v:textbox></v:shape>");
document.write("<v:rect id='_x0000_s1040' alt='' style='position:absolute;left:" + (table_x + all_width + 80) + "px;top:" + (table_y + 30 + (i)*tb_height+3) + "px;width:30px;height:20px;z-index:1' fillcolor='" + tb_color[0][i] + "'><v:fill color2='" + tb_color[1][i] + "' rotate='t' focus='100%' type='gradient'/></v:rect>");
//显示比例数
//document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + (table_x+all_width+110) + "px;top:" + (table_y+30+(i)*tb_height) + "px;width:60px;height:" + tb_height + "px;z-index:1'>");
//document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>" + Math.round(parseFloat(total[1][i]*100/totalpie)*100)/100 + "%</td></tr></table></v:textbox></v:shape>");
}
}

if(table_type == "B")
{
var pie = 3.14159265358979;
var TempPie = 0;
for(var i=0;i<total_no;i++)
{
var TempAngle = pie * 2 * (total[1][i] / (totalpie * 2) + TempPie);
var x1 = table_x + all_width/2 + Math.cos(TempAngle) * all_width * 3/8;
var y1 = table_y + all_height/2 - Math.sin(TempAngle) * all_height * 3/8;
var x2 = table_x + all_width/2 + Math.cos(TempAngle) * all_width * 3/4;
var y2 = table_y + all_height/2 - Math.sin(TempAngle) * all_height * 3/4;

if(x2>table_x + all_width/2)
{
x3 = x2 + 20;
x4 = x3;
}
else
{
x3 = x2 - 20;
x4 = x3 - 100;
}
document.write("<v:oval id='_x0000_s1027' style='position:absolute;left:" + (x1 - 2) + "px;top:" + (y1 - 2) + "px;width:4px;height:4px; z-index:2' fillcolor='#111111' strokecolor='#111111'/>");
document.write("<v:line id='_x0000_s1025' alt='' style='position:absolute;left:0;text-align:left;top:0;z-index:1' from='" + x1 + "px," + y1 + "px' to='" + x2 + "px," + y2 + "px' coordsize='21600,21600' strokecolor='#111111' strokeweight='1px'></v:line>");
document.write("<v:line id='_x0000_s1025' alt='' style='position:absolute;left:0;text-align:left;top:0;z-index:1' from='" + x2 + "px," + y2 + "px' to='" + x3 + "px," + y2 + "px' coordsize='21600,21600' strokecolor='#111111' strokeweight='1px'></v:line>");
document.write("<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:" + x4 + "px;top:" + (y2 - 10) + "px;width:100px;height:20px;z-index:1'>");
document.write("<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>" + total[0][i] + " " + Math.round(parseFloat(total[1][i] * 100/ totalpie)*100)/100 + "%</td></tr></table></v:textbox></v:shape>")
TempPie += total[1][i]/totalpie;
}
}
}
</script>
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<!--[if !mso]>
<style>
v\:* { behavior: url(#default#VML) }
o\:* { behavior: url(#default#VML) }
.shape { behavior: url(#default#VML) }
</style>
<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<style>
TD { FONT-SIZE: 9pt}
</style></head>
<body topmargin=5 leftmargin=0 scroll=AUTO>

<script language=javascript>

//=============调用方法=====================

var dataArray = new Array()
dataArray[0]=200
dataArray[1]=1200
dataArray[2]=900
dataArray[3]=600
dataArray[4]=1222
dataArray[5]=413
dataArray[6]=800
var nameArray = new Array()
nameArray[0]="中国经营报"
nameArray[1]="招聘网"
nameArray[2]="51Job"
nameArray[3]="新民晚报"
nameArray[4]="新闻晚报"
nameArray[5]="南方周末"
nameArray[6]="羊城晚报"
var total= new Array(nameArray,dataArray)

table3(total,200,40,250,250,"A");
table3(total,300,450,250,250,"B");
</script>
</body>
</html>


回复
yexing 2004-08-11
搬个小板凳:)
回复
aspgreener 2004-08-11
楼上得好厉害噢!
回复
QQgenie 2004-08-11
这个可以用在数据库,以曲线图表示趋势.代入数据只要把"'"去掉
<!--include file="conn.asp"--> //去了'#'
<HTML xmlns:v>
<HEAD>
<META http-equiv=Content-Type content=text/html;charset=gb2312>
<TITLE>趋势分析</TITLE>
<META name=Gemeratpr content=VML>
<STYLE>
v\:*{behavior:url(#default#VML);}
A{TEXT-DECORATION: none; font-size: 9pt;}
A:hover{COLOR: #FF00FF font-size: 9pt;}
A:link {color: #205064 font-size: 9pt;}
A:visited {color: #205064 font-size: 9pt;}
</STYLE>
</HEAD>
<BODY leftmargin="0">
<?xml:namespace prefix = v />

<%'//以下可从数据库取数,现只是一个例子
'//建议用:rs.GetRows
'sql ="SELECT id,sj1 FROM 2002_367 ORDER BY qh ASC"
'Set rs = Server.CreateObject("ADODB.Recordset")
'rs.open sql,conn,1,1

'aResults = rs.GetRows '//取得数据集
'iRows = UBound(aResults, 2) '//记录数
'icols = UBound(aResults, 1) '//字段数

'rs.close
'set rs=nothing
'str=""
'For row=0 to iRows
'str=str&","&aResults( 1, row )
'Next

str=",11,13,24,22,20,15,22,35,11,13,24,22,20,15"
arr=split(str,",")
plot arr,200,5,0,5,"#FF0055",5,"xx走势:"
%>
</body>
</HTML>

<%'画数组曲线
function plot(sArr,iTop,iXX,iYY,ibl,scolor,itit,stitle) '//数组,高点,X坐标,Y坐标,放大比例,颜色

strtmp="<v:shape id=nr1 style='LEFT: 0px; WIDTH: 100%; POSITION: absolute; TOP: "&iTop&"px; HEIGHT: 100%' filled = 'f' strokecolor = '"

strtmp=strtmp&scolor&"' strokeweight = '1pt' path"
strtmp=strtmp&"= 'm"&iXX&","&int(sArr(1)*ibl)*(-1)&" l"&iXX&","&int(sArr(1)*ibl)*(-1)

itemp_max=sArr(1)
itemp_min=sArr(1)
itemp_sum=0
itemp=13 'iWidth + ito
for j=2 to UBound(sArr)
if itemp_max-sArr(j)<0 then itemp_max=sArr(j)
if itemp_min-sArr(j)>0 then itemp_min=sArr(j)
itemp_sum=itemp_sum+int(sArr(j))
strtmp1=strtmp1&","&itemp*j&","&int(sArr(j)*ibl)*(-1)
next
iLeft=(itemp-3)*j '// 3 为间隔
%>
<!--功能说明-->
<SPAN style="FONT-SIZE: 12px; Z-INDEX: 1009; LEFT: <%=itit %>px; COLOR: <%=scolor%>; FONT-FAMILY: 宋体; POSITION: absolute; TOP: <%=iTop - 90%>px; BACKGROUND-COLOR: #ffffff"><%=stitle&" Max:"&itemp_max&",min:"&itemp_min&"("&itemp_sum&")"%></SPAN>
<%'//......................................................................................还有问题
ibei=1
if len(int(itemp_max)) > 1 then
ibei=10^(len(int(itemp_max))-1)
itemp_max=int(itemp_max)/ibei +1
end if
for i_n=0 to int(itemp_max)
%>
<v:line style="Z-INDEX: 1006; LEFT: 0; POSITION: absolute; TOP: <%=iTop - i_n * ibl * ibei%>px" from = "0,0" to ="<%=iLeft + 40%>px,0" strokecolor = "gray" strokeweight = ".75pt"><v:stroke dashstyle='1 1'/></v:line>
<%
next
Response.Write strtmp&strtmp1&" e'><v:path></v:path><v:fill></v:fill><v:stroke></v:stroke></v:shape>"
end function
%>
回复
xiaobird1 2004-08-11
建议使用VML。
美丽有大方。
回复
kingapex1 2004-08-11
如果是简单的
就用asp 控制img的width 也可以
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2004-08-11 08:18
社区公告
暂无公告