rem **********************************************************************
rem * Instantiate the Chart component
rem **********************************************************************
Set Chart = Server.CreateObject ("ASPChart.Chart")
rem **********************************************************************
rem * Add a Bar series with 3 points
rem **********************************************************************
Chart.AddSeries (ctBar)
Chart.AddValue 200, "Regular", vbBlue
Chart.AddValue 233, "Enhanced ", vbRed
Chart.AddValue 260, "Free", vbGreen
Chart.BarStyle = cGradient
rem **********************************************************************
rem * Set the PanelColor, remove the OuterBevel
rem **********************************************************************
Chart.PanelColor = vbWhite
Chart.BevelOuter = cNone
Chart.ChartBGColor = vbWhite
rem **********************************************************************
rem * Set the Width and Height of the image
rem **********************************************************************
Chart.Height = 300
Chart.Width = 500
rem **********************************************************************
rem * Set the filename, save the image and write the image tag
rem **********************************************************************
Chart.FileName = "d:inetpubwwwrootimagessmpchrt1.jpg"
'也不知道用Server.MapPath,不知道是笨呢還是圖效率高。
Chart.SaveChart
Response.Write "<img src=""http://edu.cnzz.cn/images/smpchrt1.jpg"">"
rem **********************************************************************
rem * Destroy the object
rem **********************************************************************
Set Chart = nothing
Multiple Series per Chart
下面這段代碼是示範如何建立多列資料的圖表的.
Set Chart = Server.CreateObject("AspChart.Chart")
Randomize
Chart.AddSeries 7 'Candle Series
dblOpen = 1000 + Rnd(100)
for intCount = 1 to 30
dblBase = Round(100*Rnd-50)
Chart.AddCandle Now + intCount, dblOpen, dblOpen+20, dblOpen-20, dblOpen+dblBase
dblOpen = dblOpen + dblBase
next