Chart with OWC11 adodb.recordset losing records

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>
 
T

Thao Moua [ms]

Chris,

Did we not alway solved this issue? I remember seeing a
similar issue. The code looks right so I can only think
of the data. Can I get a sample of your data?

Thao Moua
OWC Webchart Support

This posting is provided "AS IS" with no warranties, and
confers no rights. Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
-----Original Message-----
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")
 
C

Chris

Thanks for the reply. sample below.

Region Type Total
C1 Active 300
C1 Avg 22
C1 Power Avg 175
C1 Users 555
C2 Active 345
C2 Avg 22
C2 Power Avg 211
C2 Users 750
 
T

Thao Moua [ms]

This is a problem with Chartspace reading in recordset in
this manner. The workaround is to convert your data into
literal arrays and then pass the arrays into the SetData
() methods.

Thao Moua
OWC Webchart Support

This posting is provided "AS IS" with no warranties, and
confers no rights. Use of included script samples are
subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top