Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MSChart - 2 graphs on one chart 1

Status
Not open for further replies.

cbsm

Programmer
Oct 3, 2002
229
FR
I just discovered the MSChart control.
I'd like to get an areatype graph + a line on the same Chart.
I think I am nearly there but ...
Let's say the area chart varies from 0 to 300.
And the line is always 100.
My problem is, that the line show 100 + (currrent value of the area chart), instead of showing always 100.
Here is my code :

Sub CreateChart()
Dim recrst As ADODB.Recordset
Dim i As Integer
Set recrst = New ADODB.Recordset
Set recrst = gobjDB.RunSQLReturnRORS1("select date1,value from chart1 order by date1")

MSChart1.ChartType = VtChChartType2dCombination
MSChart1.AllowSelections = False
MSChart1.RowCount = recrst.RecordCount
MSChart1.ColumnCount = 2
....
Here I am doing some 'design' of the chart
....
'Area
i = 1
While Not recrst.EOF
MSChart1.Row = i
MSChart1.Column = 1
MSChart1.RowLabel = recrst!date1
MSChart1.Data = recrst!value
i = i + 1
recrst.MoveNext
Wend
'Line
recrst.MoveFirst
i = 1
While Not recrst.EOF
MSChart1.Row = i
MSChart1.Column = 2
MSChart1.Data = 100
i = i + 1
recrst.MoveNext
Wend
MSChart1.Plot.SeriesCollection(1).SeriesType = VtChSeriesType2dArea
MSChart1.Plot.SeriesCollection(2).SeriesType = VtChSeriesType2dLine
MSChart1.Refresh

End Sub
 
Check to see if the "SeriesColumn" setting in the MSChart control properties is set to column 1. If it is, try setting it to column 2.

-GS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top