Page 1 of 1

Again(Datetime in Addrealtime does not work)

Posted: Wed Jan 18, 2006 11:03 am
by 9523566
Thank you for your prompt reaction.
But your suggestion does not solve my problem.
No.1 is your example and No2 is modified it.
No.1 program work fine but No.2 does not work correctly.

Please check again and teach me what is wrong. Thank you in advance.
'------------------------------- No1 --------------------------------------
Dim t As Integer

Private Sub Form_Load()
With TChart1
.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
End Sub

'------------------------------No2(fro example)--------------------------------
Dim t As Double
Private Sub Form_Load()
With TChart1
.AddSeries scFastLine
.Series(0).XValues.DateTime = True
.TimerEnabled = True
.TimerInterval = 1000
End With
t= CDbl(Now)
End Sub

Private Sub TChart1_OnTimer()
t = DateAdd("s", 1, t)
TChart1.Series(0).asFastLine.AddRealTime t, Cos(t), "", clTeeColor
End Sub

Posted: Fri Jan 20, 2006 4:37 pm
by Pep
Hi,

if you want the exmple No.2 work in the same way as the example No.1 but showing datetime axis labels you should use the following code :

Code: Select all

'------------------------------No2(fro example)--------------------------------
Dim t As Double
Private Sub Form_Load()
With TChart1
.AddSeries scFastLine
.Series(0).XValues.DateTime = True
.TimerEnabled = True
.TimerInterval = 100
.Axis.Bottom.Labels.Angle = 90
.Axis.Bottom.Labels.DateTimeFormat = "hh:mm:ss"
End With
t = CDbl(Now)
End Sub

Private Sub TChart1_OnTimer()
t = DateAdd("d", 1, t)
TChart1.Series(0).asFastLine.AddRealTime t, Cos(t), "", clTeeColor
End Sub