General discussion


OWC (office web component ) chart , stacked XY scatter

By LukeAB ·
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;"

.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


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

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Repost as a 'Question'.

by CharlieSpencer In reply to OWC (office web component ...

Try reposting this using the 'Ask a Question' button. The 'Discussion' forum is for matters of general discussion, not specific problems in search of a solution.

There are TR members who specifically seek out problems in need of a solution. Although there is some overlap between the two forums, you'll find more of those members in 'Questions' than here in 'Discussions'.

Additional benefits to the membership include:

1) The "Questions" forum provides for your feedback, by way of your being able to mark "helpful" responses as such. This does not necessarily mean that a given response contained the complete solution to your problem, but only that it served to guide you toward it. This is intended to serve as an aid to those who may in the future have a problem similar to yours, so that they might have a ready source of reference available, thereby perhaps obviating the need for them to repeat questions previously asked and answered.

2) The TR search function makes it difficult to find a particular "Discussion" or "Question" if it has not had a recent post; the two types get mingled in the listings. By keeping each type in their respective forums, it is easier for all to find what they are looking for.

Related Discussions

Related Forums