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
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