Hi
I’m using the MSChart control to take two pieces of data from a recordset and populating and array to display them on my chart. The following is from my code. The data displays fine apart from I can’t get the column labels to print. It just generically calls them R1 for row 1, R2 for row 2, etc. I want them to display the actual figures (in this case week numbers.) I’ve tried this command “MSChart1.RowLabel = rs.Fields(0)” and although MSChart1.RowLabel gets populated with the correct data, the graph ignores it when it displays and puts the R1, R2, etc back!
Any ideas?
…
rs.Open DEInstance2.Commands("cmdGraphDataRetrieve").Execute
rs.MoveFirst
If Not rs.EOF Then
lngCount = rs.RecordCount
ReDim arrData(lngCount - 1, 1)
With MSChart1 'setup chart dynamics
.ShowLegend = False
.Title = "Chart”
.FootnoteText = "Print date: " & Now()
.ChartType = VtChChartType2dBar
End With
For a = 0 To 1 'fill the array by looping through the recordset, a corresponds to cols
rs.MoveFirst
For b = 0 To lngCount - 1 'b corresponds to rows
arrData(b, a) = rs(a)
rs.MoveNext
Next b
Next a
MSChart1.ChartData = arrData 'set chart data to array
With MSChart1.Plot 'add titles to the axes
.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdX).AxisTitle.Text = "Week Number"
.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdY).AxisTitle.Text = "Time Taken (Days)"
End With
End If
rs.Close 'close the recordset object and destroy the instance
Set rs = Nothing
Yada yada…
Thanks
Andrew
I’m using the MSChart control to take two pieces of data from a recordset and populating and array to display them on my chart. The following is from my code. The data displays fine apart from I can’t get the column labels to print. It just generically calls them R1 for row 1, R2 for row 2, etc. I want them to display the actual figures (in this case week numbers.) I’ve tried this command “MSChart1.RowLabel = rs.Fields(0)” and although MSChart1.RowLabel gets populated with the correct data, the graph ignores it when it displays and puts the R1, R2, etc back!
Any ideas?
…
rs.Open DEInstance2.Commands("cmdGraphDataRetrieve").Execute
rs.MoveFirst
If Not rs.EOF Then
lngCount = rs.RecordCount
ReDim arrData(lngCount - 1, 1)
With MSChart1 'setup chart dynamics
.ShowLegend = False
.Title = "Chart”
.FootnoteText = "Print date: " & Now()
.ChartType = VtChChartType2dBar
End With
For a = 0 To 1 'fill the array by looping through the recordset, a corresponds to cols
rs.MoveFirst
For b = 0 To lngCount - 1 'b corresponds to rows
arrData(b, a) = rs(a)
rs.MoveNext
Next b
Next a
MSChart1.ChartData = arrData 'set chart data to array
With MSChart1.Plot 'add titles to the axes
.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdX).AxisTitle.Text = "Week Number"
.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdY).AxisTitle.Text = "Time Taken (Days)"
End With
End If
rs.Close 'close the recordset object and destroy the instance
Set rs = Nothing
Yada yada…
Thanks
Andrew