Page 1 of 1

Zoom function - make it Snap to data point

Posted: Mon Nov 17, 2003 2:47 pm
by 9333098
Could the Zoom function be made to optionally Snap to data points like the CursorTool can and show its zooming rectangle Snapped to the nearest data point when dragging the mouse ? Perhaps the Scroll function should thus also have this property ?

Posted: Wed Nov 19, 2003 4:15 pm
by David
Thanks for your suggestion. It is already at our wish-database.

There are some issues having something like Chart1.Zoom.Snap = True.
When there are more than one series, should the snapping be done on all series or just one ? (If just one, then there must be another property to specify which series, ie: Chart1.Zoom.SnapSeries := Series 3 ).

Should snapping be done vertically, horizontally or both ?
This depends on the existing active series, if their points are sorted in the X and / or the Y direction or not. If only one direction must be considered, then the function that returns the "nearest" point to mouse XY must also take this into account.

Must be spanning done at the exact xy points location or "a little bit more" so when zooming the "snapped" points appear inside the axes limits.
Should snapping be done just when starting zooming (at the first click) or when moving the mouse?

So, all the above questions really limits or complicates having snapping as properties in Chart1.Zoom or Chart1.AllowPanning properties.

The best solution is the developer to use the Chart mouse events and customize snapping the way he / she wants.
Or, if snapping should be done only when the user releases the mouse button up, the Chart1.OnZoom event is the right place to change the desired axis min and max values to be the first and last points that "snap" to Chart1.Zoom.X and Y rectangle coordinates.

I'll prepare an example to post here in this forums or as a technical article.

regards
david