Author |
Topic  |
|
Benlehman
6 Posts |
Posted - 16 Feb 2010 : 11:57:15
|
I was wondering if there is any way to Zoom to a specific location. I need to allow the user to enter in a upper bound Point and a lower bound Point and have the chart zoom to the resulting rectangle. I couldn't find any way to do this in the ChartZoom class. If there is not currently a way can you suggest anything? The only thing I an think of is to fake the MouseDown, MouseMove and MouseUp events, but that would require me to translate the values the user entered to screen coordinates in order to get the X and Y values needed for the event calls. I dont know if it would even be possible to translate the points and I have to imagine there is an easier way. An example of this would be: the user selects X:10, Y:5 and X:20, Y:10. The chart would need to zoom so that those points are the bounds for the current scaling.
Once again thank you so much for your help. |
|
quinncurtis
1164 Posts |
Posted - 16 Feb 2010 : 13:15:47
|
Sorry, we can't follow your premise. How is "I need to allow the user to enter in a upper bound Point and a lower bound Point and have the chart zoom to the resulting rectangle" different than zooming? How do you expect the user to enter upper bound Point and lower bound Point, if not by dragging a zoom rectangle, as in zooming? |
 |
|
quinncurtis
1164 Posts |
Posted - 16 Feb 2010 : 14:27:25
|
If you are just looking for way to change the scale of the chart, with user defined values, this would work. It has nothing to do with the zoom class.
// xmin, ymin, xmax, and ymax store new physical coordinates Rectangle2D r = new Rectangle2D(); r.SetFrameFromDiaglonal(xmin, ymin, xmax, ymax) pTransform1.SetPhysScale(r);
You would of course have to autocalc the axes parameters.
xAxis.CalcAutoAxis(); yAxis.CalcAutoAxis(); xAxisLab.CalcAutoAxisLabels(); yAxisLab.CalcAutoAxisLabels(); this.UpdateDraw();
There are many examples of this type of thing in the software. Anywhere a scrollbar or button changes the current scale of the chart.
|
 |
|
|
Topic  |
|
|
|