Page 1 of 1

Drag point

Posted: Thu Jan 13, 2011 10:52 pm
by 15052665
Hi

Firstly sorry for my english

I'm trying to realise this

[URL=http://img706.imageshack.us/i/sanstitrenws.png/]Image

I managed tu put some point on the picture.
I can drag point but i need to record the position of the point i move.

For this i want to use the event "OnEndDrag" to call a program to record position.
But The even don't realize.
I don't know why.

Second problem
The position of the point in top are (70,70), i set (0,100) for minmax for X and Y but with the event "OnSeriesClickPointer", i don' recover the values.

If someone can help me please

Thank for all

Re: Drag point

Posted: Fri Jan 14, 2011 9:22 am
by narcis
Hi Onyx,
Onyx wrote:Firstly sorry for my english
No problem ;)
Onyx wrote:For this i want to use the event "OnEndDrag" to call a program to record position.
But The even don't realize.
I don't know why.
This is not the appropriate event to use, you should use OnDragPointToolDragPoint, for example:

Code: Select all

Private Sub Form_Load()
    TChart1.AddSeries scPoint
    TChart1.Series(0).FillSampleValues 10
    
    TChart1.Tools.Add tcDragPoint
    TChart1.Tools.Items(0).asDragPoint.Series = TChart1.Series(0)
End Sub

Private Sub TChart1_OnDragPointToolDragPoint(ByVal Index As Long)
    Me.Caption = CStr(TChart1.Series(0).XValues.Value(Index)) & " - " & _
                CStr(TChart1.Series(0).YValues.Value(Index))
End Sub
Onyx wrote:Second problem
The position of the point in top are (70,70), i set (0,100) for minmax for X and Y but with the event "OnSeriesClickPointer", i don' recover the values.
Having a DragPoint tool assigned to the series will "mask" the OnSeriesClickPointer event so it won't be fired. If the DragPoint tool is not assigned then you should do almost the same as in the DragPoint tool event:

Code: Select all

Private Sub Form_Load()
    TChart1.AddSeries scPoint
    TChart1.Series(0).FillSampleValues 10
End Sub

Private Sub TChart1_OnSeriesClickPointer(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, ByVal X As Long, ByVal Y As Long)
    Me.Caption = CStr(TChart1.Series(0).XValues.Value(ValueIndex)) & " - " & _
                CStr(TChart1.Series(0).YValues.Value(ValueIndex))
End Sub
Hope this helps!

Re: Drag point

Posted: Fri Jan 14, 2011 10:35 am
by 15052665
Hi
thx for your help

I'm using the event "OndragPointToolDragPoint" but with this event my program to record coordonates is always call during the drag so i have a jerk during the drag.

That why i would like call my program after the user stop the drag.

Re: Drag point

Posted: Fri Jan 14, 2011 10:43 am
by narcis
Hi Onyx,

Ok, in that case you can use the OnMouseUp event in a very similar fashion:

Code: Select all

Private Sub Form_Load()
    TChart1.AddSeries scPoint
    TChart1.Series(0).FillSampleValues 10
   
    TChart1.Tools.Add tcDragPoint
    TChart1.Tools.Items(0).asDragPoint.Series = TChart1.Series(0)
End Sub

Private Sub TChart1_OnMouseUp(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    Dim Index As Integer
    
    Index = TChart1.Series(0).Clicked(X, Y)
    
    If (Index <> -1) And TChart1.Tools.Items(0).Active Then
        Me.Caption = CStr(TChart1.Series(0).XValues.Value(Index)) & " - " & _
                    CStr(TChart1.Series(0).YValues.Value(Index))
    End If
End Sub

Re: Drag point

Posted: Fri Jan 14, 2011 11:06 am
by 15052665
Great
Works fine

Thanks a lot for your help
I can do that i want

Re: Drag point

Posted: Fri Jan 14, 2011 11:07 am
by narcis
Hi Onyx,

You're very welcome. I'm glad to hear that.

Re: Drag point

Posted: Mon Jul 18, 2011 10:29 am
by 15052665
Hi

Another question with drag point

I want to disable drag on my chart with a checkbox.

I'm using this event : Tchart1.Tools.items.active='false'
but it's possible to drag objet

What event i need to use to disable drag on tchart

Thank fo your help

Re: Drag point

Posted: Mon Jul 18, 2011 11:53 am
by 10050769
Hello Onyx,

You can use any Mouse Event. I have made an example that I disable dragPoints tool when you click with button right and enable tool when you click with left button of Mouse as you see then:

Code: Select all

Private Sub TChart1_OnMouseDown(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
 If Button = mbLeft Then
  TChart1.Tools.Items(0).Active = True
 Else
    If Button = mbRight Then
     TChart1.Tools.Items(0).Active = False
    End If
 End If
End Sub
Could you check if previous code works as you expected?

Thanks,

Re: Drag point

Posted: Mon Jul 18, 2011 12:52 pm
by 15052665
I try your exemple but the drag is not disable.

But with this method, i disable drag

Tchart1.Tools.Active=False

Thank for your help

Re: Drag point

Posted: Mon Jul 18, 2011 2:15 pm
by 10050769
Hello Onyx,
But with this method, i disable drag
Tchart1.Tools.Active=False
Using previous method you can disable the tools but all tools you have in the chart and not a determinate tool. Therefore I recommend you, use Tchart1.Tools.Items(x).Active for access to the tool as you want disable. On the other hand, I have checked following code using versions 8 and 2010 of TeeChartActiveX and works fine for me:

Code: Select all

Private Sub Form_Load()
    TChart1.AddSeries scPoint
    TChart1.Series(0).FillSampleValues 10
    TChart1.Tools.Add tcDragPoint
    TChart1.Tools.Items(0).asDragPoint.Series = TChart1.Series(0)
End Sub
Private Sub TChart1_OnMouseDown(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
 If Button = mbLeft Then
  TChart1.Tools.Items(0).Active = True
 Else
    If Button = mbRight Then
     TChart1.Tools.Items(0).Active = False
    End If
 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)
    Dim Index As Integer
    Index = TChart1.Series(0).Clicked(X, Y)
    If (Index <> -1) And TChart1.Tools.Items(0).Active Then
        Me.Caption = CStr(TChart1.Series(0).XValues.Value(Index)) & " - " & _
                    CStr(TChart1.Series(0).YValues.Value(Index))
    End If
End Sub
Can you please, check again previous code if works as you expected? If previous code still doesn't work, please try to arrange a simple project we run as-is here so we can try to find which is the problem in it.

Thanks,

Re: Drag point

Posted: Tue Jul 19, 2011 4:28 pm
by 15052665
Hi

I'm doing something wrong when i use this method : TChart1.Tools.Items(0).Active = False

I can try to use it but with my work, I miss the time.

With my method, i can do what i what so it's ok for me.

I will try to explain what i do like in a previous topic i post here, maybe you will see what i do wrong.

thank for your help

Re: Drag point

Posted: Wed Jul 20, 2011 2:36 pm
by 10050769
Hello Onyx,

Thanks for the information. We will be waiting for you feedback then. Please bear in mind that an example project reproducing the issue would be very helpful for us to be able to provide an accurate answer.

Thanks,