Is it possible to select a range of data in the data chart by dragging the mouse and then sending the data range to a bound method (viewmodel)?
Basically the functionality we need is similar to the "DragZoom" default interaction, but we want to replace the zoom operation with our own operation. Using the SeriesMouseLeftButtonDown/Up events does not work well since the start and end points are not directly over data points.
It would be great if we could get the behavoir of drawing the box as in DragZoom but opon completion just have the box boundaries sent to the viewmodel.
thanks
The StartSelection and EndSelection variables above should be the axis coordinates of the selection. Or are you talking about the screen coordinates?
Is there a way to get the actual coordinates of the rectangle drawn?We need to be able to select not only the points whose x and y is inside the rectangle, but also the ones at least 1 of whose marker points is inside the rectangle.
Simplest thing might be to have a button that toggles the behavior next to the chart. I don't believe it would be easy for you to distinguish whether the window rect changed event was occuring due to mouse wheel, mouse drag, or zoom bar. You may be able to listen to the various mouse drag events that bubble up and only perform the selection operation if a drag operation had just been performed on the chart, for example.
-Graham
Agreed on the code sample - it was REALLY helpful. THANK YOU!
I've run into a bit of a problem though - the AttemptedScale property is also set when you use a zoombar or the mouse wheel to zoom in or out. Our workflow should ideally allow zooming in/out with the zoombars or the mouse wheel while in a "selection state." Do you have any suggestions on how we can accomplish that? It would be nice to have at least a drag rectangle as a native element...
Thanks,
Gary
Graham - Your reply worked like we wanted! Thanks for the great code sample!