Page 1 of 1

How get position from ColorLineTool

Posted: Mon Jan 28, 2008 1:03 am
by 9532326
I'm using TeeChart AX 7.x.

I want to get position of ColorLineTool by mouse dragging.

How can I do this?

Thank you.

Posted: Mon Jan 28, 2008 8:51 am
by yeray
Hi greenfrog,

You can something like following:

Code: Select all

Private Sub TChart1_OnColorLineToolDragLine()
  Label1.Caption = Str$(FormatNumber(TChart1.Tools.Items(0).asColorLine.Value, 2))
End Sub
This is shown in ColorLine Demo from v8. And if you wish to have more than one ColorLines and you want to control which is dragged you should store mouse positions with OnMouseMove and use the method clicked to verify which ColorLine is dragged:

Code: Select all

Dim MouseX, MouseY As Double

Private Sub TChart1_OnColorLineToolDragLine()
  If TChart1.Tools.Items(0).asColorLine.clicked(MouseX, MouseY) Then
    Label1.Caption = Str$(FormatNumber(TChart1.Tools.Items(0).asColorLine.Value, 2))
  End If
  
  If TChart1.Tools.Items(1).asColorLine.clicked(MouseX, MouseY) Then
    Label1.Caption = Str$(FormatNumber(TChart1.Tools.Items(1).asColorLine.Value, 2))
  End If
End Sub

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  MouseX = X
  MouseY = Y
End Sub