您的位置:首页精文荟萃软件资讯 → 利用OWC画图的例子

利用OWC画图的例子

时间:2004/10/7 19:15:00来源:本站整理作者:蓝点我要评论(0)


            
             
              
             
            

               
               

            



            <% 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
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 "" & "

"
CleanUpGIF strChartAbsPath

objRS.Close
set objRS = nothing
set objConn = nothing
set objSeries = nothing
set objChart = nothing
set objChartSpace = nothing
%>



相关阅读 Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么

文章评论
发表评论

热门文章 360快剪辑怎么使用 36金山词霸如何屏幕取词百度收购PPS已敲定!3

最新文章 微信3.6.0测试版更新了微信支付漏洞会造成哪 360快剪辑怎么使用 360快剪辑软件使用方法介酷骑单车是什么 酷骑单车有什么用Apple pay与支付宝有什么区别 Apple pay与贝贝特卖是正品吗 贝贝特卖网可靠吗

人气排行 xp系统停止服务怎么办?xp系统升级win7系统方电脑闹钟怎么设置 win7电脑闹钟怎么设置office2013安装教程图解:手把手教你安装与qq影音闪退怎么办 QQ影音闪退解决方法VeryCD镜像网站逐个数,电驴资料库全集同步推是什么?同步推使用方法介绍QQ2012什么时候出 最新版下载EDiary——一款好用的电子日记本