Page 1 of 1
Series as a Vertical Line
Posted: Fri Mar 17, 2006 7:08 am
by 9083304
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
Posted: Fri Mar 17, 2006 8:52 am
by narcis
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
Posted: Fri Mar 17, 2006 9:58 am
by 9083304
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
Posted: Fri Mar 17, 2006 10:44 am
by narcis
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.