Page 1 of 1

Bottom axis scrolling

Posted: Sun Mar 07, 2004 1:05 pm
by 9080645
hello,

how can I make the bottom axis scroll this way:

- I have automatic scale OFF and set fixed number of data points (1000)
- I add data values every second
- when e.g. 800 data points have been added, the bottom axis should start scrolling, but NOT losing the data points --> also manual scrolling should be enabled to scroll previous values

I use TeeChart Pro ActiveX version 6.0.0.4 in ASP pages. I use scLine for drawing the chart and addXY method for adding the data points.

Thanks

Mike

Posted: Mon Mar 08, 2004 9:29 pm
by Pep
Hi Mike,

you can use similar code like in the following example :

Code: Select all

Dim LMax
Private Sub Form_Load()
With TChart1
    .Aspect.View3D = False
    .AddSeries scLine
    For i = 37000 To 37000 + (2 / 1440) Step (1 / 86400)
        .Series(0).AddXY i, Rnd * 100, "", clTeeColor
    Next i
    .Series(0).XValues.DateTime = True
    .Axis.Bottom.Labels.DateTimeFormat = "dd/mm/yy hh:mm:ss"
    .Axis.Bottom.Labels.Angle = 90
    .Axis.Left.StartPosition = 50
End With
'*********************************
'Data added in "real time"
'**********************************
With TChart1
    .AddSeries scLine
    .Series(1).XValues.DateTime = True
    .Series(1).VerticalAxis = aRightAxis
    .Series(1).HorizontalAxis = aTopAxis
    .Axis.Top.Labels.DateTimeFormat = "dd/mm/yy hh:mm:ss"
    .Axis.Top.Labels.Angle = 90
    .Axis.Right.EndPosition = 50
    
    .TimerEnabled = True
    .TimerInterval = 1000
    .Axis.Top.SetMinMax Now, Now + (2 / 1440)
    .Axis.Right.SetMinMax .Series(0).YValues.Minimum, .Series(0).YValues.Maximum
    LMax = Now + (2 / 1440)
End With
'**********************************
End Sub

Private Sub TChart1_OnTimer()
With TChart1
    .Series(1).AddXY Now, Rnd * 100, "", clTeeColor
    If .Series(1).XValues.Maximum >= LMax Then
     .Axis.Top.SetMinMax Now - (2 / 1440), Now
    End If
End With
End Sub