Drag point

TeeChart for ActiveX, COM and ASP
Post Reply
Onyx
Newbie
Newbie
Posts: 16
Joined: Fri Feb 27, 2009 12:00 am

Drag point

Post by Onyx » Thu Jan 13, 2011 10:52 pm

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

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

Re: Drag point

Post by Narcís » Fri Jan 14, 2011 9:22 am

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!
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

Onyx
Newbie
Newbie
Posts: 16
Joined: Fri Feb 27, 2009 12:00 am

Re: Drag point

Post by Onyx » Fri Jan 14, 2011 10:35 am

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.

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

Re: Drag point

Post by Narcís » Fri Jan 14, 2011 10:43 am

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
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

Onyx
Newbie
Newbie
Posts: 16
Joined: Fri Feb 27, 2009 12:00 am

Re: Drag point

Post by Onyx » Fri Jan 14, 2011 11:06 am

Great
Works fine

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

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

Re: Drag point

Post by Narcís » Fri Jan 14, 2011 11:07 am

Hi Onyx,

You're very welcome. I'm glad to hear that.
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

Onyx
Newbie
Newbie
Posts: 16
Joined: Fri Feb 27, 2009 12:00 am

Re: Drag point

Post by Onyx » Mon Jul 18, 2011 10:29 am

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

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Drag point

Post by Sandra » Mon Jul 18, 2011 11:53 am

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,
Best Regards,
Sandra Pazos / 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

Onyx
Newbie
Newbie
Posts: 16
Joined: Fri Feb 27, 2009 12:00 am

Re: Drag point

Post by Onyx » Mon Jul 18, 2011 12:52 pm

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

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Drag point

Post by Sandra » Mon Jul 18, 2011 2:15 pm

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,
Best Regards,
Sandra Pazos / 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

Onyx
Newbie
Newbie
Posts: 16
Joined: Fri Feb 27, 2009 12:00 am

Re: Drag point

Post by Onyx » Tue Jul 19, 2011 4:28 pm

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

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Drag point

Post by Sandra » Wed Jul 20, 2011 2:36 pm

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,
Best Regards,
Sandra Pazos / 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