您的位置:首页 > 软件资讯 > 正文

利用OWC画图的例子

来源:网络 作者: 时间:2020-10-14

<% Option Explicit %>利用OWC画图的例子处理 SSI 文件时出错 <%Function ExportChartToGIF(objCSpace, strAbsFilePath, strRelFilePath)Dim strFileNameRandomize strFileName = Timer & Rnd & ".gif"objCSpace.ExportPicture strAbsFilePath & "\" & strFileName, "gif", 600, 350ExportChartToGIF = strRelFilePath & "/" & strFileNameEnd FunctionSub CleanUpGIF(GIFpath)Dim objFSDim objFolderDim gifset objFS = Server.CreateObject("Scripting.FileSystemObject")set objFolder = objFS.GetFolder(GIFpath)for each gif in objFolder.Filesif instr(gif.Name, ".gif") > 0 and DateDiff("n", gif.DateLastModified, now) > 10 thenobjFS.DeleteFile GIFpath & "\" & gif.Name, Trueend ifnextset objFolder = nothingset objFS = nothingEnd Sub%><%dim objChartSpacedim objChartdim objSeriesdim objConndim objRSdim cdim seriesdim strChartAbsPathdim strChartRelPathdim strChartFilestrChartAbsPath = Server.MapPath("/mypath/temp")strChartRelPath = "temp"set objChartSpace = Server.CreateObject("OWC.Chart")set objChart = objChartSpace.Charts.Add()set c = objChartSpace.ConstantsobjChart.Type = c.chChartTypeLineMarkersobjChart.HasLegend = Trueset 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 = objConnobjRS.CursorType = adOpenStaticobjRS.CursorLocation = adUseClientobjRS.Open "select * from testscore order by test"set objChartSpace.DataSource = objRSobjChart.SetData c.chDimSeriesNames, 0, "student"for each objSeries in objChart.SeriesCollectionobjSeries.SetData c.chDimCategories, 0, "test"objSeries.SetData c.chDimValues, 0, "score"nextfor each axis in objChart.Axesaxis.HasTitle = Trueif axis.Type = c.chCategoryAxis thenaxis.Title.Caption = "Test"elseaxis.Title.Caption = "Score"end ifnextobjChart.SeriesCollection(2).Interior.Color = "red"objChart.SeriesCollection(2).Line.Color = "red"strChartFile = ExportChartToGIF(objChartSpace, strChartAbsPath, strChartRelPath)Response.Write "" & "

"CleanUpGIF strChartAbsPathobjRS.Closeset objRS = nothingset objConn = nothingset objSeries = nothingset objChart = nothingset objChartSpace = nothing%>
学校收费系统 https://www.xiaobaoonline.com/payment

【责任编辑:admin】