Drag chart with right mouse button

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
gs
Newbie
Newbie
Posts: 84
Joined: Mon Mar 20, 2006 12:00 am
Location: US

Drag chart with right mouse button

Post by gs » Wed Feb 06, 2008 5:28 pm

The user can drag my chart using the right mouse button. How do I return the chart to the original position programatically? I would like the user to be able to double click on the chart and return to the original position. How can I do this?

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

Post by Narcís » Thu Feb 07, 2008 8:48 am

Hi gs,

Yes, this can be done using TeeChart's DoubleClick event like this:

Code: Select all

      void tChart1_DoubleClick(object sender, EventArgs e)
      {
        tChart1.Zoom.Undo();
      }
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

gs
Newbie
Newbie
Posts: 84
Joined: Mon Mar 20, 2006 12:00 am
Location: US

Post by gs » Thu Feb 07, 2008 8:56 am

Hi Narcis, thanks for your reply. However, that's not quite what I had in mind.

If I hold the right mouse button down and drag the chart off to the right, for example, the graph moves and the axes move with it, so it's not really a zoom, and Zoom.Undo doesn't take the graph back to it's initial position. I want to reset the origin back to where it was and move the graph back as well

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

Post by Narcís » Thu Feb 07, 2008 3:07 pm

Hi gs,

Even the chart is not zoomed Zoom.Undo resets the chart for me here using latest TeeChart for .NET v3 release. Anyway, another option is saving initial left and bottom axes minimum and maximum values to local variables and restore them using Axis.SetMinMax() when the user double-clicks the chart.

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

Post Reply