Page 1 of 1

Drag chart with right mouse button

Posted: Wed Feb 06, 2008 5:28 pm
by 9640703
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?

Posted: Thu Feb 07, 2008 8:48 am
by narcis
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();
      }

Posted: Thu Feb 07, 2008 8:56 am
by 9640703
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

Posted: Thu Feb 07, 2008 3:07 pm
by narcis
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!