dim stats
dim rs
dim sql
dim cndim rs1
dim sql1
dim cn1
dim field1 'Hold data returned
'dim field2 'Hold name
dim strXML 'strXML will be used to store the entire XML document generated
'Default.asp has passed us a property animate. We request that.
Dim animateChart
animateChart = Request.QueryString("animate")
'Set default value of 1
if animateChart="" then
animateChart = "1"
end if
'Make db conx
cn = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=serverip;DATABASE=netops;USER=root;PASSWORD=password;OPTION=3"
set rs = server.createobject("adodb.recordset")
sql = "SELECT Count(Ticket) as field0 FROM Tkt_tickets WHERE YEAR(ResolvedTime) = 2006 GROUP BY Year(ResolvedTime), Month(ResolvedTime)"
cn1 = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=serverip;DATABASE=netops;USER=root;PASSWORD=password;OPTION=3"
set rs1 = server.createobject("adodb.recordset")
sql1 = "SELECT Count(Ticket) as field1 FROM Tkt_tickets WHERE YEAR(ResolvedTime) = 2007 GROUP BY Year(ResolvedTime), Month(ResolvedTime)"
'Start XML data
strXML = "<chart caption='Tickets Worked Results 2006 v 2007' xAxisName='Month' yAxisName='Revenue' showValues='0' numberPrefix='$'>
strXML = strXML & "<categories>"
strXML = strXML & "<category label='Jan' />"
strXML = strXML & "<category label='Feb' />"
strXML = strXML & "<category label='Mar' />"
strXML = strXML & "<category label='Apr' />"
strXML = strXML & "<category label='May' />"
strXML = strXML & "<category label='Jun' />"
strXML = strXML & "<category label='Jul' />"
strXML = strXML & "<category label='Aug' />"
strXML = strXML & "<category label='Sep' />"
strXML = strXML & "<category label='Oct' />"
strXML = strXML & "<category label='Nov' />"
strXML = strXML & "<category label='Dec' />"
strXML = strXML & "</categories>"
'Open db and grab 2006 records
strXML = strXML & "<dataset seriesName='2006' color='FF9601'>"
rs.open sql, cn
do while not rs.eof
'Write the data line
strXML = strXML & "<set value='" & rs("field0") & "'/>"
'Go to next record
rs.movenext
loop
strXML = strXML & "</dataset>"
'Open db and grab 2007 records
strXML = strXML & "<dataset seriesName='2007' color='0000C0'>"
rs1.open sql1, cn1
do while not rs1.eof
'Write the data line
strXML = strXML & "<set value='" & rs1("field1") & "'/>"
'Go to next record
rs1.movenext
loop
strXML = strXML & "</dataset>"
strXML = strXML & "<trendlines>"
strXML = strXML & "<line startValue='26000' color='91C728' displayValue='Target' showOnTop='1'/>"
strXML = strXML & "</trendlines>"
'Finally, close <chart> element
strXML = strXML & "</chart>"
'Close loops and conx
rs.close
Set rs = nothing
rs1.close
Set rs1 = nothing
'Set Proper output content-type
Response.ContentType = "text/xml"
'Just write out the XML data
'NOTE THAT THIS PAGE DOESN'T CONTAIN ANY HTML TAG, WHATSOEVER
Response.Write(strXML)
This is in the first page.
'Variable to contain dataURL
Dim strDataURL'Set DataURL with animation property to 1
'NOTE: It's necessary to encode the dataURL if you've added parameters to it
strDataURL = "TktByMonthData.asp"
'Create the chart - Pie 3D Chart with dataURL as strDataURL
Call renderChart("Includes/ChartsSWF/MSColumn3D.swf", strDataURL, "", "stats", 600, 400, false, false)