Series as a Vertical Line

TeeChart for ActiveX, COM and ASP
Post Reply
Rossmc
Newbie
Newbie
Posts: 27
Joined: Wed Jul 28, 2004 4:00 am
Location: South Africa

Series as a Vertical Line

Post by Rossmc » Fri Mar 17, 2006 7:08 am

I have used a standard series line to create a vertical line on the face of my chart where the user clicks. This means I can use all the series events (mouseenter, onclickseries etc) to let the user interact with the line which is helpful. I would like them to be able to move the line, much like it is possible to move a colour line. I have implemented my own scrolling and have problems with the colour line which is another reason I am using the series for this functionality.

So, is it possible to drag a series?

Thanks

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Mar 17, 2006 8:52 am

Hi Rossmc,

The easiest way to achieve that would be using a HorizontalLine series and a DragPoint tool and implement in the tool's DragPoint event that when a point is moved all other points are moved as well. You can do that using something like this:

Code: Select all

Private Sub Form_Load()
    TChart1.AddSeries scHorizLine
    TChart1.Tools.Add tcDragPoint
    
    TChart1.Tools.Items(0).asDragPoint.Series = TChart1.Series(0)

    For i = 0 To 10
        TChart1.Series(0).Add 10, "", clTeeColor
    Next
    
    TChart1.Axis.Bottom.SetMinMax 0, 100
End Sub

Private Sub TChart1_OnDragPointToolDragPoint(ByVal Index As Long)
    For i = 0 To TChart1.Series(0).Count - 1
        If (i <> Index) Then
            TChart1.Series(0).XValues.Value(i) = TChart1.Series(0).XValues.Value(Index)
        End If
    Next
End Sub
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Rossmc
Newbie
Newbie
Posts: 27
Joined: Wed Jul 28, 2004 4:00 am
Location: South Africa

Post by Rossmc » Fri Mar 17, 2006 9:58 am

Thanks Narcis

I didn't mentio that I am still on version 6 of the control which does not appear to have the OnDragPointToolDragPoint event.

Is there a way to do something similar in version 6?
What version does that event available in?
What are my upgrade options/costs?

Thanks again

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Mar 17, 2006 10:44 am

Hi Rossmc,
I didn't mentio that I am still on version 6 of the control which does not appear to have the OnDragPointToolDragPoint event.

Is there a way to do something similar in version 6?
Yes, I can now think of a way of doing that in v6 but it's not much elegant as first only one point is repositioned and when the point is released the whole series is repositioned.

Code: Select all

Dim StartDrag As Boolean
Dim Index As Integer

Private Sub Form_Load()
    TChart1.AddSeries scHorizLine
    TChart1.Tools.Add tcDragPoint
    
    TChart1.Tools.Items(0).asDragPoint.Series = TChart1.Series(0)

    For i = 0 To 10
        TChart1.Series(0).Add 10, "", clTeeColor
    Next
    
    TChart1.Axis.Bottom.SetMinMax 0, 100
    
    StartDrag = False
End Sub

Private Sub TChart1_OnMouseDown(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    Index = TChart1.Series(0).Clicked(X, Y)
    
    If (Index <> -1) Then
        StartDrag = True
    End If
End Sub

Private Sub TChart1_OnMouseUp(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    If StartDrag Then
        For i = 0 To TChart1.Series(0).Count - 1
            If (i <> Index) Then
                TChart1.Series(0).XValues.Value(i) = TChart1.Series(0).XValues.Value(Index)
            End If
        Next
    End If

    StartDrag = False
End Sub
What version does that event available in?
That event was included in TeeChart Pro v7 ActiveX.
What are my upgrade options/costs?


You can find upgrading information at our on-line order section. For further information please contact our sales dept. at sales@steema.com.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply