最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
利用OWC画图的例子
时间:2022-06-30 11:15:03 编辑:袖梨 来源:一聚教程网
<% Option Explicit %>
>
利用OWC画图的例子
<%
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
%>
<%
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
>
<%
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
%>
<%
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