网页上实现动态统计图一直都是很多web程序员感到很头痛的事。经过一段时间对vml的研究,发现要实现html页面上的统计图还是很方便的。现在我就将我用asp+vml实现的立体统计图原码发给大家,希望对大家有所帮助。(如果要转贴请大家还是把我的名字保留下来,毕竟是我花了很多时间的劳动成果哈。:))
上一篇我们看了饼图,接下来我们看看曲线图。鼠标移动到相应项目上则显示该项目的曲线图,鼠标移开则消失。如果要一起显示比较几个项目只需要在项目上单击鼠标左键即可。
<%
'┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
'┃ ┃
'┃ 摘 要: 统计图--曲线图 ┃
'┃ 作 者: 翁云兵 ┃
'┃ 创建日期:2004年12月01日 ┃
'┃ 完成日期:2004年11月03日 ┃
'┃ ┃
'┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
'参数含义(数组,横坐标,纵坐标,图表的宽度,图表的高度,图表标题,X轴单位,Y轴单位)
function table1(stat_array,table_left,table_top,all_width,all_height,table_title,X_unit,Y_unit)
dim bg_color(10)
bg_color(1)="#ff1919"
bg_color(2)="#ffff19"
bg_color(3)="#1919ff"
bg_color(4)="#19ff19"
bg_color(5)="#fc0"
bg_color(6)="#3cc"
bg_color(7)="#ff19ff"
bg_color(8)="#993300"
bg_color(9)="#f60"
bg_color(10)="#ff8c19"
if X_unit <> "" then
X_unit = X_unit
end if
if Y_unit <> "" then
Y_unit = Y_unit
end if
num1 = ubound(stat_array,1)
line_temp=split(stat_array(0,1),",")
num2 = ubound(line_temp,1)+1
dim line_code
redim line_code(num1,num2)
for j=1 to num2
line_code(0,j) = line_temp(j-1)
next
for i=1 to num1
line_temp = split(stat_array(i,1),",")
line_code(i,0) = stat_array(i,2)
for j=1 to num2
line_code(i,j) = cdbl(line_temp(j-1))
next
next
value_Max=0
for i=1 to num1
for j=1 to num2
if value_Max<line_code(i,j) then value_Max=line_code(i,j)
next
next
value_Max = cint(value_Max)
value_Max_str =cstr(value_Max)
if value_Max>9 then
temp=mid(value_Max_str,2,1)
if temp>4 then
temp2=(int(value_Max/(10^(len(value_Max_str)-1)))+1)*10^(len(value_Max_str)-1)
else
temp2=(int(value_Max/(10^(len(value_Max_str)-1)))+0.5)*10^(len(value_Max_str)-1)
end if
else
if value_Max>4 then temp2=10 else temp2=5
end if
item_hight = temp2/5
item_width = 20000/(num2-1)
response.Write "<v:rect id='background' style='position:absolute;left:"&table_left&"px;top:"&table_top&"px;WIDTH:"&all_width&"px;HEIGHT:"&all_height&"px;' fillcolor='#EFEFEF' strokecolor='gray'>"
response.Write " <v:shadow on='t' type='single' color='silver' offset='4pt,4pt'/>"
response.Write "</v:rect>"
response.Write "<v:group ID='table' style='position:absolute;left:"&table_left&"px;top:"&table_top&"px;WIDTH:"&all_width&"px;HEIGHT:"&all_height&"px;' coordsize = '27500,12800'>"
response.Write " <v:Rect style='position:relative;left:1500;top:200;width:23000;height:800'filled='false' stroked='f'>"
response.Write " <v:TextBox inset='0pt,0pt,0pt,0pt'>"
response.Write " <table width='100%' border='0' align='center' cellspacing='0'>"
response.Write " <tr>"
response.Write " <td align='center' valign='middle'><div style='font-size:15pt; font-family:黑体;'><B>"&table_title&"</B></div></td>"
response.Write " </tr>"
response.Write " </table>"
response.Write " </v:TextBox>"
response.Write " </v:Rect> "
response.Write " <v:rect id='back' style='position:relative;left:1700;top:1200;width:20500; height:10500;' fillcolor='#9cf' strokecolor='#DFDFDF'>"
response.Write " <v:fill rotate='t' angle='-45' focus='100%' type='gradient'/>"
response.Write " </v:rect>"
response.Write " <v:rect id='back2' style='position:relative;left:23000;top:1200;width:4000; height:"&(10500)&";' fillcolor='#9cf' stroked='t' strokecolor='#0099ff'>"
response.Write " <v:fill rotate='t' angle='-175' focus='100%' type='gradient'/>"
response.Write " <v:shadow on='t' type='single' color='silver' offset='3pt,3pt'/>"
response.Write " </v:rect>"
for i=1 to num1
if i=1 then
displaystr=""
else
displaystr="none"
end if
response.Write " <div style='cursor:hand;' onmouseover='moveon(rec"&i&",line_"&i&")' onmouseout='moveout(rec"&i&",line_"&i&","&i&")' onclick='clickit("&i&")'>"
response.Write " <v:Rect id='rec"&i&"' style='position:relative;left:23100;top:"&(i-1)*10200/10+1450&";width:3800;height:800;display:"&displaystr&";' fillcolor='#efefef' strokecolor='"&bg_color(i)&"'>"
response.Write " <v:fill opacity='.6' color2='fill darken(118)' o:opacity2='.6' rotate='t' method='linear sigma' focus='100%' type='gradient'/>"
response.Write " </v:Rect>"
response.Write " <v:Rect style='position:relative;left:23200;top:"&(i-1)*10200/10+1500&";width:600;height:700' fillcolor='"&bg_color(i)&"' stroked='f'/>"
response.Write " <v:Rect style='position:relative;left:24000;top:"&(i-1)*10200/10+1500&";width:3400;height:700' filled='f' stroked='f'>"
response.Write " <v:TextBox inset='0pt,4pt,0pt,0pt' style='font-size:9pt;'><div align='left'>"&stat_array(i,2)&"</div></v:TextBox>"
response.Write " </v:Rect> "
response.Write " </div> "
next
response.Write " <v:line ID='X' from='1700,11700' to='22700,11700' style='z-index:2' strokecolor='#000000' strokeWeight=1pt><v:stroke EndArrow='Classic'/></v:line>"
response.Write " <v:line ID='Y' from='1700,900' to='1700,11700' style='z-index:2' strokecolor='#000000' strokeWeight=1pt><v:stroke StartArrow='Classic'/></v:line>"
response.Write " <v:Rect style='position:relative;left:100;top:700;width:1500;height:500' filled='false' stroked='false'>"
response.Write " <v:TextBox inset='0pt,0pt,0pt,0pt' style='font-size:9pt;'><div align='right'>"&Y_unit&"</div></v:TextBox>"
response.Write " </v:Rect> "
response.Write " <v:Rect style='position:relative;left:22200;top:11900;width:2000;height:500' filled='false' stroked='false'>"
response.Write " <v:TextBox inset='0pt,0pt,0pt,0pt' style='font-size:9pt;'><div align='left'>"&X_unit&"</div></v:TextBox>"
response.Write " </v:Rect> "
for i=0 to 4
response.Write " <v:line from='1300,"&i*2000+1700&"' to='1700,"&i*2000+1700&"' style='z-index:2' strokecolor='#000000'></v:line>"
response.Write " <v:line from='1700,"&i*2000+1700&"' to='2200,"&i*2000+1200&"' style='z-index:2' strokecolor='#0099FF'></v:line>"
response.Write " <v:line from='2200,"&i*2000+1200&"' to='22200,"&i*2000+1200&"' style='z-index:2' strokecolor='#0099FF'></v:line>"
response.Write " <v:line from='2200,"&i*2000+2200&"' to='22200,"&i*2000+2200&"' style='z-index:2' strokecolor='#0099FF'>"
response.Write " <v:stroke dashstyle='Dot'/>"
response.Write " </v:line>"
response.Write " <v:Rect style='position:relative;left:100;top:"&i*2000+1250&";width:1500;height:500' filled='false' stroked='false'>"
response.Write " <v:TextBox inset='0pt,0pt,0pt,0pt' style='font-size:9pt;'><div align='right'>"&item_hight*(5-i)&"</div></v:TextBox>"
response.Write " </v:Rect> "
next
response.Write " <v:line from='2200,11200' to='22200,11200' style='z-index:2' strokecolor='#0099FF'></v:line>"
response.Write " <v:line from='2200,1200' to='2200,11200' style='z-index:2' strokecolor='#0099FF'></v:line>"
response.Write " <v:line from='1700,11700' to='2200,11200' style='z-index:2' strokecolor='#0099FF'></v:line>"
for j=0 to num2-1
response.Write " <v:line from='"&j*item_width+1700&",11700' to='"&j*item_width+1700&",12000' style='z-index:2' strokecolor='#000000'></v:line>"
response.Write " <v:line from='"&j*item_width+1700&",11700' to='"&j*item_width+2200&",11200' style='z-index:2' strokecolor='#0099FF'><v:stroke dashstyle='ShortDot'/></v:line>"
response.Write " <v:line from='"&j*item_width+2200&",1200' to='"&j*item_width+2200&",11200' style='z-index:2' strokecolor='#0099FF'><v:stroke dashstyle='ShortDot'/></v:line>"
response.Write " <v:Rect style='position:relative;left:"&j*item_width+1700-item_width/2&";top:12100;width:"&item_width&";height:500' filled='false' stroked='false'>"
response.Write " <v:TextBox inset='0pt,0pt,0pt,0pt' style='font-size:9pt;'><div align='center'>"&line_code(0,j+1)&"</div></v:TextBox>"
response.Write " </v:Rect> "
next
for i=1 to num1
if i=1 then
displaystr=""
else
displaystr="none"
end if
response.Write " <div id='line_"&i&"' style='display:"&displaystr&";'>"
for j=0 to num2-2
this_hight1 = cint(line_code(i,j+1)/(5*item_hight)*10000)
this_hight2 = cint(line_code(i,j+2)/(5*item_hight)*10000)
response.Write " <v:line from='"&j*item_width+1850&","&(10000-this_hight1+1550)&"' to='"&(j+1)*item_width+1850&","&(10000-this_hight2+1550)&"'style='z-index:"&i*10&";' strokeweight='0.1pt' strokecolor='"&bg_color(i)&"'>"
response.Write " <o:extrusion v:ext='view' backdepth='12pt' on='t' lightposition='-50000,-50000' lightposition2='50000'/>"
response.Write " </v:line>"
next
response.Write " </div>"
next
response.Write "</v:group>"
end function
%>
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<title></title>
<STYLE>
v\:* { Behavior: url(#default#VML) }
o\:* { behavior: url(#default#VML) }
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
var showit = new Array(10);
function moveon(iteam,lineit){
temp=eval(iteam)
templine=eval(lineit)
if(showit[1]){
rec1.style.display = "";
line_1.style.display = "";
}else{
rec1.style.display = "none";
line_1.style.display = "none";
}
temp.style.display = "";
templine.style.display = "";
}
function moveout(iteam,lineit,i){
temp=eval(iteam)
templine=eval(lineit)
if (showit[i]){
temp.style.display = "";
templine.style.display = "";
}else{
temp.style.display = "none";
templine.style.display = "none";
}
}
function clickit(i){
if (showit[i]){
showit[i]=false
}else{
showit[i]=true
}
}
-->
</script>
</head>
<body>
<%
dim total(10,2)
total(0,1)="1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月"
total(1,1)="200,158,982,0,369,100,595,895,652,25,245,951"
total(2,1)="984,58,495,36,158,486,952,258,653,415,485,14"
total(3,1)="850,988,958,145,369,745,265,158,856,145,425,352"
total(4,1)="600,525,235,485,258,265,158,365,35,148,658,475"
total(5,1)="62,525,635,215,0,465,258,305,66,547,54,148"
total(6,1)="560,625,645,329,158,665,358,95,120,358,42,253"
total(7,1)="950,725,635,435,258,865,458,955,152,845,425,421"
total(8,1)="600,825,155,455,458,265,558,365,352,245,853,122"
total(9,1)="360,925,215,545,658,465,658,845,400,421,541,125"
total(10,1)="50,225,355,655,858,665,758,35,584,214,54,651"
total(1,2)="项目1"
total(2,2)="项目2"
total(3,2)="项目3"
total(4,2)="项目4"
total(5,2)="项目5"
total(6,2)="项目6"
total(7,2)="项目7"
total(8,2)="项目8"
total(9,2)="项目9"
total(10,2)="项目10"
call table1(total,240,200,700,350,"曲 线 统 计 图","时间","元")
%>
</body>
</html>
分享到:
相关推荐
本示例"带tooltip的js+vml曲线图示例"展示了如何利用JavaScript和VML(Vector Markup Language)技术来构建具有提示功能的曲线图表。这个教程将帮助开发者更好地理解和实现这样的功能。 首先,让我们了解JavaScript...
4. **第三方库**:为了简化流程图的创建,开发者通常会使用像D3.js、Fabric.js或者GoJS这样的JavaScript库,它们提供了丰富的API和图形功能,可以方便地在ASP.NET应用中集成。 综上所述,"asp.net+vml流程图代码...
网页制作\网页源码\动态曲线 ASP+VML
在本案例中,"真正的ASP+VML生成曲线图形"是指使用ASP技术结合VML(Vector Markup Language)来创建和显示曲线图形。 VML是一种基于XML的矢量图形标准,主要用于在网页上绘制和展示复杂图形,包括曲线、直线、形状...
这个"vml+javascript直接在浏览器中绘制动态曲线图实例"提供了源码,可以帮助我们理解如何使用VML和JavaScript实现这一功能。首先,我们需要在HTML页面中定义VML的命名空间,并设置CSS样式以便在IE浏览器中正确显示...
在本主题中,“ASP+VML读取数据库并生成曲线图”涉及到的技术是使用ASP技术来从数据库中提取数据,并利用VML(Vector Markup Language)生成曲线图表。下面将详细介绍这两个关键知识点。 1. ASP (Active Server ...
以前发布过一个asp+vml曲线图代码,现在看到一个js+vml曲线图代码 <HTML xmlns:v="urn:schemas-microsoft-com:vml"xmlns:o="urn:schemas-microsoft-com:office:office"> <meta http-equiv="Content-Type" content=...
在这个“asp+vml图表 矩形图示例”中,开发者可能使用ASP动态生成VML代码,以创建一个矩形图,这种图形通常用于表示数据分布或比较。VML的优点在于它可以生成高质量的图形,并且在没有安装额外插件的情况下也能在...
要使用ASP和VML创建统计图表,我们需要遵循以下步骤: 1. **数据准备**:首先,我们需要获取要显示在图表中的数据。这通常来自数据库,通过ASP连接和查询SQL语句来获取。 2. **创建ASP页面**:创建一个新的ASP页面...
在提供的文件"流程设计.htm"中,很可能包含了一个用HTML和VML实现的工作流程示例。"流程设计_files"可能是一个文件夹,包含了支持该页面运行的额外资源,如CSS样式表、JavaScript文件或图片。通过查看这些文件,我们...
首先,VML是一种基于XML的语言,它允许在网页上绘制复杂的图形,包括线条、曲线、形状以及我们关注的饼状图。VML的优点在于其矢量特性,这意味着图形可以在任何分辨率下保持清晰,无论用户如何缩放浏览器窗口。在ASP...
在“vml+javascript直接在浏览器中绘制动态曲线图实例”中,我们主要学习如何通过JavaScript与VML结合,在不支持SVG(Scalable Vector Graphics)的老版IE浏览器中绘制动态曲线图。SVG是另一种更现代的矢量图形标准...
在给定的资源中,"asp\asp.net统计图VML"是一个关于如何在ASP和ASP.NET中创建统计图表的教程或组件,主要涵盖了饼图、曲线图和柱图这三种常见的数据可视化形式。 VML,全称Vector Markup Language,是一种用于在...
用javascript+ajax+vml生成折线图javascript类打包
实现了vml+html中显示的,并解决了ie浏览器兼容的问题,代码直接运行便好用
【ASP+VML技术详解:动态读取数据库与生成曲线图】 在Web开发中,呈现数据可视化是至关重要的,尤其在数据分析、报表制作和业务监控等领域。ASP(Active Server Pages)是一种经典的服务器端脚本语言,常用于构建...
本主题聚焦于一种特定的技术,即使用VML(Vector Markup Language)和JavaScript来创建3D柱状图,这是一种针对IE浏览器的解决方案。在本文中,我们将深入探讨这些技术及其在实现3D柱状图中的应用。 首先,我们来看...
vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml...
在ASP.NET开发中,有时我们需要在网页上展示各种统计数据,如柱状图、饼状图等,这通常可以通过使用各种图形库或插件来实现。然而,有些情况下,我们可能希望避免引入额外的依赖,或者因为性能和轻量化的需求,选择...
给出部分代码: '画X柱子 dim PolyLine1,PolyLine2 For i = 1.5 To uboundY+1 'step 0.5 xRect = (i-1)*allX\uboundY height1 = -allY * arr(1,int(i)) / arrMax height2 = -allY * arr(2,int(i)) / arrMax ...