Hi, there,
I manually set the x-axis range as
m_chart.GetAxis().GetBottom().SetAutomatic(FALSE);
m_chart.GetAxis().GetBottom().SetMaximum(100.0);
m_chart.GetAxis().GetBottom().SetMinimum(0.0);
And if I use AddRealTime to add data continuously, the display can automatically extend the maxim x value while keeping the range be 100, but AddXY can't do it. Is there any way the AddXY can do the same thing automatically?
Another question is that I want to manually set an initial x range but the range can be extended if the data number exceed the preset maxim x while keeping the display starting from the preset minimum x. As the sample code above, if the data number exceed 100, the chart can display from 0 to final data number. How can I do that?
Thank you very much!
David
AddRealTime vs AddXY
Hi David,
using the AddXY method this cannot be done automatically , but you should be able to use the SetMinMax method in the OnAfterAdd event and customize it as your own.
using the AddXY method this cannot be done automatically , but you should be able to use the SetMinMax method in the OnAfterAdd event and customize it as your own.
Pep Jorge
http://support.steema.com
http://support.steema.com
Hi, Pep,
If I use AddRealTime, is it possible to automatically realize what is discribe in question below? Or Do I still have to use the SetMinMax method in the OnAfterAdd event every time the maxim x changes?
"Another question is that I want to manually set an initial x range but the range can be extended if the data number exceed the preset maxim x while keeping the display starting from the preset minimum x. As the sample code above, if the data number exceed 100, the chart can display from 0 to final data number. How can I do that?
"
Thank you very much!
David
If I use AddRealTime, is it possible to automatically realize what is discribe in question below? Or Do I still have to use the SetMinMax method in the OnAfterAdd event every time the maxim x changes?
"Another question is that I want to manually set an initial x range but the range can be extended if the data number exceed the preset maxim x while keeping the display starting from the preset minimum x. As the sample code above, if the data number exceed 100, the chart can display from 0 to final data number. How can I do that?
"
Thank you very much!
David
Hi David,
yes, using AddRealTime will extend the Axis (but minimum and maximum). To extend only the maximum you will have to use similar code to the following :
yes, using AddRealTime will extend the Axis (but minimum and maximum). To extend only the maximum you will have to use similar code to the following :
Code: Select all
Dim t As Integer
Private Sub Form_Load()
With TChart1
.Aspect.View3D = False
.Axis.Bottom.Automatic = False
.Axis.Bottom.SetMinMax 0, 100
.AddSeries scFastLine
.TimerEnabled = True
.TimerInterval = 100
End With
End Sub
Private Sub TChart1_OnTimer()
t = t + 1
TChart1.Series(0).asFastLine.AddRealTime t, Cos(t), "", clTeeColor
If t > 100 Then
TChart1.Axis.Bottom.Minimum = 0
End If
End Sub
Pep Jorge
http://support.steema.com
http://support.steema.com