Chart scroll

TeeChart for ActiveX, COM and ASP
Post Reply
Ariel Tetro
Newbie
Newbie
Posts: 21
Joined: Mon Nov 03, 2003 5:00 am
Contact:

Chart scroll

Post by Ariel Tetro » Wed Apr 21, 2004 12:59 pm

Hi,

Is there a way to connect a scroll bar that will do the chart's scrolling, instead of using the mouse's right/left click?
I know this feature is available on the non ActiveX version, but is it, or will be, available?

Ariel

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

Post by Pep » Wed Apr 21, 2004 1:16 pm

Hi Ariel,

yes, you can do this using a ScrollBar and similar code to the following :

Code: Select all

Dim AxisMin, AxisMax

Private Sub Form_Load()
HScroll1.Min = 0
HScroll1.Max = 100
HScroll1.Value = 50
With TChart1
    .Aspect.View3D = False
    .AddSeries scLine
    For i = 0 To 100
        .Series(0).AddXY i, Rnd * 100, "", clTeeColor
    Next i
    .Environment.InternalRepaint
    AxisMin = .Axis.Bottom.Minimum
    AxisMax = .Axis.Bottom.Maximum
End With
End Sub
 
Private Sub HScroll1_Scroll()
With TChart1
    If HScroll1.Value < 50 Then
        .Axis.Bottom.SetMinMax AxisMin - (50 - HScroll1.Value), AxisMax - (50 - HScroll1.Value)
    Else
        .Axis.Bottom.SetMinMax AxisMin + (HScroll1.Value - 50), AxisMax + (HScroll1.Value - 50)
    End If
End With
End Sub
 
Private Sub TChart1_OnScroll()
With TChart1
    If (.Axis.Bottom.Minimum + 50) > HScroll1.Min And (.Axis.Bottom.Maximum - 50) < HScroll1.Max Then
        HScroll1.Value = .Axis.Bottom.Minimum + 50
    End If
End With
End Sub

Post Reply