Binding ChChart to ADO rs

J

jj1

I am having a bit of trouble binding OWC10 Chart Component to an ADO
recordset. The following code works fine for accessing an ADO recordset
persisted in Rowset format in OWC9, but I can't port it to OWC10 running
under ASP.NET without errors in the "SetData" statement. Can someone
please help? I would like to use OWC10 in order to use the GetPicture
method rather than the ExportPicture method.



Thanks.



Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim cn As New ADODB.Connection

cn.ConnectionString = "Provider=mspersist"

cn.Open()



Dim rs As New ADODB.Recordset

rs.Open("C:\inetpub\wwwroot\webapplication11\temp.xml", cn,
ADODB.CursorTypeEnum.adOpenStatic,
ADODB.LockTypeEnum.adLockOptimistic)



Dim cs As New OWC.ChartSpace

cs.Clear()

Dim cht = cs.Charts.Add

cht.Type = OWC.ChartChartTypeEnum.chChartTypeScatterLineMarkers



Dim cds = cs.ChartDataSources.Add

cds.DataSource = rs



cht.SetData(OWC.ChartDimensionsEnum.chDimSeriesNames, 0, "Mode")

Dim s As OWC.WCSeries

For Each s In cht.SeriesCollection

s.SetData(OWC.ChartDimensionsEnum.chDimXValues, 0, "Vbam")

s.SetData(OWC.ChartDimensionsEnum.chDimYValues, 0, "Mirr")

Next s

cht.Axes(OWC.ChartAxisPositionEnum.chAxisPositionLeft).Scaling.-
Type = OWC.ChartScaleTypeEnum.chScaleTypeLogarithmic

cht.Axes(OWC.ChartAxisPositionEnum.chAxisPositionLeft).Majo-
rUnit = 10

cs.ExportPicture("C:\inetpub\wwwroot\webapplication11\chart2.gi-
f", "gif", 600, 400)



cn = Nothing

rs = Nothing

cs = Nothing

cht = Nothing

cds = Nothing



Response.Clear()

Response.ContentType = "image/gif"

Response.WriteFile("C:\inetpub\wwwroot\webapplication11\ch-
art2.gif")

Response.End()

End Sub
 

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

Similar Threads

Stacked Column Chart 0

Top