When you write an ASP program, you may have to display various indicators in a graphic manner. If it is just a histogram, a method of drawing can be used. Many voters use this method. If it is a pie chart or then retrieved from the database, it is a bit difficult. The method also has, you can package Excel to complete the above features, or use deiphi to make an ActiveForm into the parameter, or write it with PHP, Java also can. Of course, use a more mature graphic assembly to do better. Microsoft Office Web Compoent is very good. I used this component when I developed a project.
Chart.asp program.
<% OPTION Explicit%>
<%
Function ExportChartTogif (Objcspace, StrabsFilePath, StrrelFilePath)
DIM STRFILENAME
Randomize
Strfilename = Timer & Res & ".gif"
Objcspace.exportPicture StrabsfilePath & "& StrfileName," GIF ", 650, 400
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>
<%
DIM SJ1, SJ2
SJ1 = Request.QueryString ("S1")
SJ2 = Request.QueryString ("S2")
Dim objChartspace
Dim objChart
Dim objSeries
DIM Objconn
DIM OBJRS
DIM C
DIM Series
DIM STRCHARTABSPATH
DIM STRCHARTRELPATH
DIM STRCHARTFILE
Dim Axis
STRCHARTABSPATH = Server.mappath ("/ xjsi-web / dcss / chart") STRCHARTRELPATH = "/ xjsi-web / dcss / chart"
'Settings Components
Set objChartSpace = Server.createObject ("Owc.chart")
Set objchart = objchartspace.Charts.add
SET C = ObjChartspace.Constants
Objchartspace.border.color = "red"
'Displaying the histogram
ObjChart.Type = 1
Objchart.haslegegend = true 'Display legend
ObjChartSpace.haschartspaceTitle = true 'display headline
Objchartspace.ChartSpaceTitle.caption = "Example of the histogram use Office Web Components - Www.orfly.com Chinese Technology Website"
Set objconn = server.createObject ("adoDb.connection")
Objconn.open Application ("strconn")
Set objrs = server.createObject ("adoDb.recordset")
Set objrs.activeConnection = Objconn
Objrs.cursortype = adopenStatic
Objrs.cursorLocation = aduseclient
Objrs.open "SELECT DWSJ, SUM (JFRS) AS JFRS
From dcss_do_jfgcfxb where dwsj> = '"& sj1 &"' and dwsj <'"& sj2 &"
Group by dwsj order by dwsj ASC "
Set objChartSpace.DataSource = ObJRS
'Display legend content
Objchart.SetData C.chdimseriesNames, 0, "JFRS"
For Each ObjSeries in Objchart.seriescollection
ObjSeries.SetData C.chdimcategories, 0, "DWSJ"
ObjSeries.SetData C.chdimvalues, 0, "JFRS"
NEXT
For Each Axis in Objchart.axes
Axis.hastitle = TRUE
if Axis.Type = C.chcategoryAxis Then
Axis.title.caption = "Month"
Else
Axis.title.caption = "Number of people"
END IF
NEXT
Strchartfile = exportcharttogif (ObjchartAbspath, Strchartrelpath)
Response.write "" Cleanupgif Strchartabspath
Objrs.close
Set objrs = Nothing
Set objconn = Nothing
Set objseries = Nothing
Set objChart = Nothing
Set objChartspace = Nothing
%>
div>
Body>
Html>