C
Chris
Hi,
I have a prob with an ASP page i have written to do a
quick graph.
I pull records from 3 diff DB's and create my own
ADO.recordset and populate it with the returned values.
I then set the the chartspace datasource to this
recordset and then make my chart. The prob i have is that
it does not chart the first 3 records.
To test it i output the recordset into a table on the
client. it shows all the records. I then run thru the
chart stuff it is missing the first 3 records i then
output the recordset after that and it is missing the 3
records.
Any ideas, cause i am out of them? ( as a workaround i
populate the recordset with 3 fake records and ensure
they r at the beginning of the table using a sort )
Below is an excerpt of the code.
Thanks
Chris
<%
set objRS = server.createobject("ador.recordset")
objRS.fields.append "Region", advarchar, 20
objRS.fields.append "Type", advarchar, 30,adFldIsNullable
objRS.fields.append "Total", adinteger, 4,adFldIsNullable
' left out the SQL connections and queries
%>
<%
'outputs the recordset which shows all records
objRS.movefirst %>
<TABLE><tr><TH>Region</TH><TH>Type</TH><TH>Total</TH></tr>
<%
Do While Not objRS.eof
Response.Write("<tr><td>" & objRS("Region") & "</td><td>"
& objRS("Type") & "</td><td>" & objRS("Total")
& "</td></tr>")
objRS.movenext
Loop
%>
</table>
<%
' doing the chart stuff here
dim objChartSpace
dim objChart
dim objSeries
dim objConn
dim objRS
dim c
dim series
dim strChartAbsPath
dim strChartRelPath
dim strChartFile
strChartAbsPath = Server.MapPath("./gifs/")
strChartRelPath = "./gifs/"
set objChartSpace = Server.CreateObject
("OWC11.Chartspace")
set objChart = objChartSpace.Charts.Add()
set c = objChartSpace.Constants
objchartspace.DisplayFieldButtons = False
objChart.Type = c.chChartTypeColumnClustered
objChart.HasLegend = True
objrs.movefirst
'set the recordset here
set objChartSpace.DataSource = objRS
objchart.SetData c.chDimSeriesNames, 0, "Type"
objchart.SetData c.chDimCategories, 0, "Region"
objchart.SetData c.chDimValues, 0, "Total"
objchart.HasTitle = True
objchart.Title.Caption = "Avvid Stats"
set fnt = objchart.Title.Font
fnt.Name = "Tahoma"
fnt.Size = 10
fnt.Bold = True
set ax = objchart.Axes(c.chAxisPositionBottom)
ax.HasTitle = True
ax.Title.Caption = "Type"
set fnt = ax.Title.Font
fnt.Name = "Tahoma"
fnt.Size = 8
fnt.Bold = True
'add a title to the value axis and format the title
set ax = objchart.Axes(c.chAxisPositionLeft)
'ax.NumberFormat = "Number"
ax.HasTitle = True
ax.Title.Caption = "Total"
set fnt = ax.Title.Font
fnt.Name = "Tahoma"
fnt.Size = 8
fnt.Bold = true
objChartspace.charts.delete 1
'display chart - missing the first 3 records
strChartFile = ExportChartToGIF(objChartSpace,
strChartAbsPath, strChartRelPath)
Response.Write "<p align=center><IMG SRC=""" &
strChartFile & """>" & "</P>"
objRS.movefirst
'output recordset into a table again- missing first 3
records
%>
<TABLE><tr><TH>Region</TH><TH>Type</TH><TH>Total</TH></tr>
<%
Do While Not objRS.eof
Response.Write("<tr><td>" & objRS("Region") & "</td><td>"
& objRS("Type") & "</td><td>" & objRS("Total")
& "</td></tr>")
objRS.movenext
Loop
%>
</table>
I have a prob with an ASP page i have written to do a
quick graph.
I pull records from 3 diff DB's and create my own
ADO.recordset and populate it with the returned values.
I then set the the chartspace datasource to this
recordset and then make my chart. The prob i have is that
it does not chart the first 3 records.
To test it i output the recordset into a table on the
client. it shows all the records. I then run thru the
chart stuff it is missing the first 3 records i then
output the recordset after that and it is missing the 3
records.
Any ideas, cause i am out of them? ( as a workaround i
populate the recordset with 3 fake records and ensure
they r at the beginning of the table using a sort )
Below is an excerpt of the code.
Thanks
Chris
<%
set objRS = server.createobject("ador.recordset")
objRS.fields.append "Region", advarchar, 20
objRS.fields.append "Type", advarchar, 30,adFldIsNullable
objRS.fields.append "Total", adinteger, 4,adFldIsNullable
' left out the SQL connections and queries
%>
<%
'outputs the recordset which shows all records
objRS.movefirst %>
<TABLE><tr><TH>Region</TH><TH>Type</TH><TH>Total</TH></tr>
<%
Do While Not objRS.eof
Response.Write("<tr><td>" & objRS("Region") & "</td><td>"
& objRS("Type") & "</td><td>" & objRS("Total")
& "</td></tr>")
objRS.movenext
Loop
%>
</table>
<%
' doing the chart stuff here
dim objChartSpace
dim objChart
dim objSeries
dim objConn
dim objRS
dim c
dim series
dim strChartAbsPath
dim strChartRelPath
dim strChartFile
strChartAbsPath = Server.MapPath("./gifs/")
strChartRelPath = "./gifs/"
set objChartSpace = Server.CreateObject
("OWC11.Chartspace")
set objChart = objChartSpace.Charts.Add()
set c = objChartSpace.Constants
objchartspace.DisplayFieldButtons = False
objChart.Type = c.chChartTypeColumnClustered
objChart.HasLegend = True
objrs.movefirst
'set the recordset here
set objChartSpace.DataSource = objRS
objchart.SetData c.chDimSeriesNames, 0, "Type"
objchart.SetData c.chDimCategories, 0, "Region"
objchart.SetData c.chDimValues, 0, "Total"
objchart.HasTitle = True
objchart.Title.Caption = "Avvid Stats"
set fnt = objchart.Title.Font
fnt.Name = "Tahoma"
fnt.Size = 10
fnt.Bold = True
set ax = objchart.Axes(c.chAxisPositionBottom)
ax.HasTitle = True
ax.Title.Caption = "Type"
set fnt = ax.Title.Font
fnt.Name = "Tahoma"
fnt.Size = 8
fnt.Bold = True
'add a title to the value axis and format the title
set ax = objchart.Axes(c.chAxisPositionLeft)
'ax.NumberFormat = "Number"
ax.HasTitle = True
ax.Title.Caption = "Total"
set fnt = ax.Title.Font
fnt.Name = "Tahoma"
fnt.Size = 8
fnt.Bold = true
objChartspace.charts.delete 1
'display chart - missing the first 3 records
strChartFile = ExportChartToGIF(objChartSpace,
strChartAbsPath, strChartRelPath)
Response.Write "<p align=center><IMG SRC=""" &
strChartFile & """>" & "</P>"
objRS.movefirst
'output recordset into a table again- missing first 3
records
%>
<TABLE><tr><TH>Region</TH><TH>Type</TH><TH>Total</TH></tr>
<%
Do While Not objRS.eof
Response.Write("<tr><td>" & objRS("Region") & "</td><td>"
& objRS("Type") & "</td><td>" & objRS("Total")
& "</td></tr>")
objRS.movenext
Loop
%>
</table>