如何在asp中创建图表? (50分)

  • 主题发起人 我要上
  • 开始时间

我要上

Unregistered / Unconfirmed
GUEST, unregistred user!
我现在在作一个统计的项目,需要用到图表,
打算用Office web components(office 自带的组件),
里面有图表,
但不知如何下手,有谁会用,或者已经有这方面的例子,请
赐教!
 
怎么?无人问津
 
打开office再生成html,再看看
 
这个我当然知道,问题是如何用代码生成动态的图表???
 
没用过,我想应该调用office提供的接口吧!
 
使用组件,server.createobject(....) 里面好像是mschart之类的,找找吧
 
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include virtual="../../inc/identify.asp" -->
<!--#include virtual="../../conn/conn.asp" -->
<html>
<head>
<title>Untitleddo
cument</title>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
<script language=VBScript>
function newHref()
ifdo
cument.all.selecttype.value=1 then
location.href="statYearTime1.asp?t_year="+document.all.t_year.value
else
ifdo
cument.all.selecttype.value=2 then
location.href="?t_year="+document.all.t_year.value
else
ifdo
cument.all.selecttype.value=3 then
location.href="statYearTime3.asp?t_year="+document.all.t_year.value
else
return false
end if
newHref=true
end function
Sub Window_OnLoad()
Dim categories(12)
Dim values(12)
Dim chConstants
categories(0) = "一月份"
categories(1) = "二月份"
categories(2) = "三月份"
categories(3) = "四月份"
categories(4) = "五月份"
categories(5) = "六月份"
categories(6) = "七月份"
categories(7) = "八月份"
categories(8) = "九月份"
categories(9) = "十月份"
categories(10) = "十一月份"
categories(11) = "十二月份"
ChartSpace1.Clear
ChartSpace1.Charts.Add
Set chConstants = ChartSpace1.Constants
ChartSpace1.Charts(0).Type = chConstants.chChartTypeLineMarkers

ChartSpace1.Charts(0).SeriesCollection.Add
ChartSpace1.Charts(0).SeriesCollection(0).Caption =do
cument.all.titles.value

values(0) =do
cument.all.hd01.value
values(1) =do
cument.all.hd02.value
values(2) =do
cument.all.hd03.value
values(3) =do
cument.all.hd04.value
values(4) =do
cument.all.hd05.value
values(5) =do
cument.all.hd06.value
values(6) =do
cument.all.hd07.value
values(7) =do
cument.all.hd08.value
values(8) =do
cument.all.hd09.value
values(9) =do
cument.all.hd010.value
values(10) =do
cument.all.hd011.value
values(11) =do
cument.all.hd012.value
ChartSpace1.Charts(0).SeriesCollection(0).SetData chConstants.chDimCategories, chConstants.chDataLiteral, categories
ChartSpace1.Charts(0).SeriesCollection(0).SetData chConstants.chDimValues, chConstants.chDataLiteral, values
ChartSpace1.Charts(0).HasLegend = True
End Sub
</script>
<link href="../../css/style.css" rel="stylesheet" type="text/css">
</head>
<%
t_year=request.QueryString("t_year")
%>
<body topmargin="0" rightmargin="0" leftmargin="0" bottommargin="0">
<table width="100%"><tr><td height="30" class="btd1">数据来源:<%=session("county")%>&amp;nbsp;&amp;nbsp;时间:<%=t_year%>年</td></tr></table>
<object classid=CLSID:0002E556-0000-0000-C000-000000000046 width="80%" height="80%" align="absmiddle" id=ChartSpace1 style="width:100%;height:350">
</object>
<form>
<input name="t_year" type="hidden" value="<%=t_year%>">
<%
set rs=server.CreateObject("adodb.recordset")
sqlstr="select m.mainid ,m.h_sum from h_year_report m where m.h_date='"+cstr(t_year)+"'"
rs.open sqlstr,conn,1,3
mainid=rs(0)
sum=rs(1)
sum=session("county")+t_year+"年 案件总数"+cstr(rs(1))
%>
<input type="hidden" name="titles" value="<%=sum%>">
<%
rs.close()

set rs01=server.createobject("adodb.recordset")
sqlstr="select k.timeslice,k.h_sum from h_year_report_time k where k.mainid='"+cstr(mainid)+"' order by to_number(k.timeslice)"
rs01.open sqlstr,conn,1,3
for i=1 to 12
namestr="hd0"+cstr(i)
%>
<input name="<%=namestr%>" type="hidden" value="<%=rs01(1)%>">
<%
rs01.movenext
next
rs01.close()
%>
</form>
<table width="100%" class="text9">
<tr>
<td align="center"><select name="selecttype" size="1" id="selecttype" onChange="newHref()" >
<option value="0" selected>请选择</option>
<option value="1">圆饼图</option>
<option value="2">折线图</option>
<option value="3">矩状图</option>
</select>
&amp;nbsp;&amp;nbsp;<a href="../incept/inceptindex.asp">返 回</a></td>
</tr>
</table>
</body>
</html>
 
怎么不用asp.net
 
顶部