AddRealTime vs AddXY

TeeChart for ActiveX, COM and ASP
Post Reply
David
Advanced
Posts: 203
Joined: Tue Nov 08, 2005 5:00 am

AddRealTime vs AddXY

Post by David » Wed Apr 19, 2006 2:21 am

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

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Apr 24, 2006 9:10 am

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.

David
Advanced
Posts: 203
Joined: Tue Nov 08, 2005 5:00 am

Post by David » Mon Apr 24, 2006 9:24 am

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

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Apr 27, 2006 3:46 pm

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

David
Advanced
Posts: 203
Joined: Tue Nov 08, 2005 5:00 am

Post by David » Fri Apr 28, 2006 12:56 am

Thank you very much, Pep.

Post Reply