最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp 曲线图生成实例代码
时间:2022-07-02 23:04:12 编辑:袖梨 来源:一聚教程网
<%
'''''''''''''''''''''''''''''''''''''''''''''
' 功能:asp读取数据库教程中数据生成统计折线图
' 开发:wangsdong
' 地址:www.111com.net
' 支持原创,保留此信息,谢谢
'''''''''''''''''''''''''''''''''''''''''''''
date1=cdate("2008-01-01 00:00:00")
date2=cdate("2008-12-31 23:59:59")
sql="select sum(m_value) as t,m_month from table1 where m_time>=#"&date1&"# and m_time<=#"&date2&"# group by m_month"
rs.open sql,conn,1,1
if rs.eof then
else
redim total(1,2)
s=""
v1=""
do while not rs.eof
s=s&","&rs("m_month")&"月"
v1=v1&","&rs("t")
rs.movenext
loop
total(0,1)=right(s,len(s)-1)
total(1,1)=right(v1,len(v1)-1)
total(1,2)="2008年业绩图"
end if
rs.close
set rs=nothing
call table1(total,20,20,700,350,"曲线统计图","时间","元")
%>
asp代码
<%
dim ConnStr
dim conn
'on error resume next
m=1
If m=1 Then
db="111.mdb"
path=Server.MapPath(DB)
set conn=server.createobject("adodb.Connection")
connstr="provider=Microsoft.Jet.OLEDB.4.0;Data Source="&path
conn.Open connstr
else
ConnStr= "Provider = Sqloledb; User ID = " & "sa" & "; Password = " & "fuckchc" & "; Initial Catalog = " & "tianyipt" & "; Data Source = " & "server" & ";"
ConnStr= "Provider = Sqloledb; User ID = " & "sa" & "; Password = " & "" & "; Initial Catalog = " & "aaaa" & "; Data Source = " & "localhost" & ";"
'ConnStr= "Provider = Sqloledb; User ID = " & "sa" & "; Password = " & "" & "; Initial Catalog = " & "mydb" & "; Data Source = " & "localhost" & ";"
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnStr
End if
Set rs=server.CreateObject("adodb.recordset")
'┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
'┃ ┃
'┃ 摘 要: 统计图--曲线图 ┃
'┃ 作 者: 翁云兵 ┃
'┃ 创建日期: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
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_/(num2-1)
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write " "
"
response.Write " " "
response.Write " "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
for i=1 to num1
if i=1 then
displaystr=""
else
displaystr="none"
end if
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
next
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
for i=0 to 4
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
next
response.Write "
response.Write "
response.Write "
for j=0 to num2-1
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
response.Write "
next
for i=1 to num1
if i=1 then
displaystr=""
else
displaystr="none"
end if
response.Write "
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 "
response.Write "
response.Write "
next
response.Write "
next
response.Write "
end function
%>
相关文章
- 王者荣耀侦探能力大测试攻略 王者荣耀侦探能力大测试怎么过 11-22
- 无期迷途主线前瞻兑换码是什么 11-22
- 原神欧洛伦怎么培养 11-22
- 炉石传说网易云音乐联动怎么玩 11-22
- 永劫无间手游确幸转盘怎么样 11-22
- 无期迷途主线前瞻兑换码是什么 无期迷途主线前瞻直播兑换码介绍 11-22