Page 1 of 1

AddRealTime vs AddXY

Posted: Wed Apr 19, 2006 2:21 am
by 9529132
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

Posted: Mon Apr 24, 2006 9:10 am
by Pep
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.

Posted: Mon Apr 24, 2006 9:24 am
by 9529132
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

Posted: Thu Apr 27, 2006 3:46 pm
by Pep
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 :

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

Posted: Fri Apr 28, 2006 12:56 am
by 9529132
Thank you very much, Pep.