利用OWC画图的例子 |
|
作者:未知 文章来源:网络文摘 更新时间:2006-5-10 2:33:08 |
【声明:转载此信息在于传递更多信息,其内容表达的观点并不代表本站立场,由这些信息所产生的一切后果本站不负任何责任。如果您对本信息有什么意见,欢迎和本站联系,谢谢!】http://CiDu.Net
<% Option Explicit %> <HTML> <HEAD> <TITLE>利用OWC画图的例子</TITLE> <!-- #include virtual="/include/adovbs.inc" --> <% Function ExportChartToGIF(objCSpace, strAbsFilePath, strRelFilePath) Dim strFileName Randomize strFileName = Timer & Rnd & ".gif" objCSpace.ExportPicture strAbsFilePath & "" & strFileName, "gif", 600, 350 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"> <% dim objChartSpace dim objChart dim objSeries dim objConn dim objRS dim c dim series dim strChartAbsPath dim strChartRelPath dim strChartFile strChartAbsPath = Server.MapPath("/mypath/temp") strChartRelPath = "temp"
set objChartSpace = Server.CreateObject("OWC.Chart") set objChart = objChartSpace.Charts.Add() set c = objChartSpace.Constants
objChart.Type = c.chChartTypeLineMarkers objChart.HasLegend = True
set objConn = Server.CreateObject("ADODB.Connection") objConn.Open "provider=sqloledb;data source=myserver;initial catalog=testdb;user id=myuid;password=mypswd;" set objRS = Server.CreateObject("ADODB.Recordset") set objRS.ActiveConnection = objConn objRS.CursorType = adOpenStatic objRS.CursorLocation = adUseClient objRS.Open "select * from testscore order by test" set objChartSpace.DataSource = objRS objChart.SetData c.chDimSeriesNames, 0, "student" for each objSeries in objChart.SeriesCollection objSeries.SetData c.chDimCategories, 0, "test" objSeries.SetData c.chDimValues, 0, "score" next
for each axis in objChart.Axes axis.HasTitle = True if axis.Type = c.chCategoryAxis then axis.Title.Caption = "Test" else axis.Title.Caption = "Score" end if next
objChart.SeriesCollection(2).Interior.Color = "red" objChart.SeriesCollection(2).Line.Color = "red"
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 %> </BODY> </HTML>
声明:以上信息资料大都是网上搜集而来,版权归作者,如有版权问题请留言告知我将马上改正。 文中所提到的各种观点只是原文观点,各种说法未经一一确认。并不代表本站认可此观点!!
|
资讯录入:admin 责任编辑:admin |
|
上一篇资讯: 给ASP增加绘图功能(画饼图,条形图,各种形状图象的组件)
下一篇资讯: 利用MSCHART画图的一段代码 |
【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |