当前位置:K88软件开发文章中心编程语言AspAsp01 → 文章内容

asp读取数据库中数据生成统计折线图

减小字体 增大字体 作者:佚名     来源:asp编程网  发布时间:2018-12-30 8:32:25

最近两天在做统计的时候,在网上找到生成折线图的代码,但是我现在要从数据库中读取数据生成折线图,找了好久,没有找到,最后还是自己动手去写,经过这两天的测试,搞定了,现在发出来与大家共享。
<
!--
#include file="adoconn.asp" -->

<
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>

<
%
'''''''''''''''''''''''''''''''''''''''''''''
' 功能:asp读取数据库中数据生成统计折线图
' 开发:wangsdong
' 地址:www.aspprogram.cn
' 支持
'''''''''''''''''''''''''''''''''''''''''''''
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,"曲线统计图","时间","元")
% >

<
/body>

<
/html>


源码下载地址:http://www.aspprogram.cn/html/soft/2009328221831.html

 



asp读取数据库中数据生成统计折线图