asp图表代码

wjjydwjjyd 2007-11-27 03:41:27
各位高手,是否有asp的年(12个月)柱形图的代码,望各位不吝赐教
...全文
174 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
钛元素 2007-11-27
  • 打赏
  • 举报
回复
嘿嘿,刚好收集了,共享下:

<% Option Explicit %>
<HTML>
<HEAD>
<TITLE>柱状图的例子</TITLE>
<%
Function ExportChartToGIF(objCSpace, strAbsFilePath, strRelFilePath)
Dim strFileName
Randomize
strFileName = Timer & Rnd & ".gif"
objCSpace.ExportPicture strAbsFilePath & "\" & strFileName, "gif", 650, 400
ExportChartToGIF = strRelFilePath & "/" & strFileName
End Function

Sub CleanUpGIF(GIFpath)
Dim objFS
Dim objFolder
Dim gif
set objFS = Server.CreateObject("Scripting.FileSystemObject")
set objFolder = objFS.GetFolder(GIFpath)
for each gif in objFolder.Files
if instr(gif.Name, ".gif") > 0 and DateDiff("n", gif.DateLastModified, now) > 10 then
objFS.DeleteFile GIFpath & "\" & gif.Name, True
end if
next
set objFolder = nothing
set objFS = nothing
End Sub

%>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<div align="center">
<br>
<br>
<%
dim sj1,sj2
sj1=Request.QueryString("s1")
sj2=Request.QueryString("s2")

dim objChartSpace
dim objChart
dim objSeries
dim objConn
dim objRS
dim c
dim series
dim strChartAbsPath
dim strChartRelPath
dim strChartFile
dim axis

strChartAbsPath = Server.MapPath("/xjsi-web/dCSS/chart")
strChartRelPath = "/xjsi-web/dCSS/chart"
'设置组件

set objChartSpace = Server.CreateObject("OWC.Chart")
set objChart = objChartSpace.Charts.Add
set c = objChartSpace.Constants

objChartSpace.Border.Color="red"
'以柱状图显示
objchart.type=1
objChart.HasLegend = True'是否显示图例
objChartSpace.HasChartSpaceTitle=true '显示标题
objChartSpace.ChartSpaceTitle.Caption ="柱状图的例子使用office web组件--www.ourfly.com中文技术网站"
set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open application("strconn")
set objRS = Server.CreateObject("ADODB.Recordset")
set objRS.ActiveConnection = objConn
objRS.CursorType = adOpenStatic
objRS.CursorLocation = adUseClient
objRS.Open "select dwsj,sum(jfrs) as jfrs from dCSS_do_jfgcfxb where dwsj>='"&sj1&"' and dwsj<'"&sj2&"' group by dwsj order by dwsj asc"

set objChartSpace.DataSource = objRS
'显示图例内容
objChart.SetData c.chDimSeriesNames, 0, "jfrs"
for each objSeries in objChart.SeriesCollection
objSeries.SetData c.chDimCategories, 0, "dwsj"
objSeries.SetData c.chDimValues, 0, "jfrs"
next

for each axis in objChart.Axes
axis.HasTitle = True
if axis.Type = c.chCategoryAxis then
axis.Title.Caption = "月份"
else
axis.Title.Caption = "人数"
end if
next

strChartFile = ExportChartToGIF(objChartSpace, strChartAbsPath, strChartRelPath)
Response.Write "<IMG SRC=../../""" & strChartFile & """>" & "<P>"
CleanUpGIF strChartAbsPath

objRS.Close
set objRS = nothing
set objConn = nothing
set objSeries = nothing
set objChart = nothing
set objChartSpace = nothing
%>
</div>
</BODY>
</HTML>
xuStanly 2007-11-27
  • 打赏
  • 举报
回复
VML够用了。
littlelam 2007-11-27
  • 打赏
  • 举报
回复
http://www.microsystem.cn/vmlChart/
http://www.cnblogs.com/Files/MicroSystem/MicroSystem.CN%20VMLChart.zip
PyCoders 2007-11-27
  • 打赏
  • 举报
回复
找VML相关的资料应该可以找到
zhouyuzhu 2007-11-27
  • 打赏
  • 举报
回复
asp作图功能我一直没学会,帮顶

28,404

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧