OWC (office web component ) chart , stacked XY scatter

  • Thread starter Thread starter LukeB
  • Start date Start date
L

LukeB

I am using office web component chart v11 (Microsoft Office Chart
11.0) in Access 2007. I can chart a XY scatter fine. But I want chart
a stacked XY, i.e. 2 Y axes, 1 X axis, I can only seem to drop a
single field into the "Drop Data Fields here " area.

Also, I want to use the recset method and databound NOT dataliteral

The code that I am using is below, and where it fails :

Private Sub Command7_Click()

Dim cnn As ADODB.Connection, rst As ADODB.Recordset, strSQL As
String
Dim ser As OWC11.ChSeries
Dim cht As OWC11.ChChart
Set cnn = New ADODB.Connection


Dim oChart As ChChart
Dim oSeries1 As ChSeries
Dim oSeries2 As ChSeries


Dim oConst

' = = = = = = =
' get the data from the SQLServer into a recset

With cnn
.ConnectionTimeout = 500
.Provider = "SQLOLEDB.1"
.ConnectionString = "Provider=SQLOLEDB.1;Persist Security
Info=TRUE;" & _
"Integrated
Security=SSPI;Initial Catalog=MyTestDB;" & _
"Data Source=SrvrSQL02;"

.Open
.CommandTimeout = 500
End With
strSQL = "SELECT * FROM dbo.tblTmpB"
Set rst = New ADODB.Recordset
With rst
.CursorLocation = adUseClient

.CursorType = adOpenStatic
.Open strSQL, cnn
End With



Debug.Print rst.RecordCount


' = = = =
' clear chart and draw a XY scatter

With Me.ChartSpace1

.Clear
.Refresh

Set oConst = .Constants
Set .DataSource = rst


Set oSeries1 = .Charts(0).SeriesCollection.Add
oSeries1.Type = chChartTypeScatterLine

oSeries1.SetData oConst.chDimXValues, oConst.chDataBound,
"depth_m" ' <--- FAILS here
oSeries1.SetData oConst.chDimYValues, oConst.chDataBound,
"BRD"

End With

end sub
 
Back
Top