Hello,
I am evaluating SciChart (for info : v 2.3) for integration into a WPF application. For the application is important that the user can interact with the chart.
So I have been trying to get that working with SciChart : with the MouseWheelZoomModifier we can use the mouse wheel to zoom the chart and with ZoomPanModifier we can use the left-mouse button to pan the chart. Excellent !
But then we would like to have the same behavior on the axes : Mouse wheel to zoom an axis and left-mouse button to move it up and down. Until now I found only the XAxisDragModifier to make an axis interactive but that has a quite different behavior.
So my question is : How can I get the same zooming and panning behavior on the axes ?
thanks in advance for any help,
Stefaan
Norway
- srillaert asked 10 years ago
- You must login to post comments
Hi Stefaan,
I believe that MouseWheelModifier has zoom and pan in X or Y direction when you hold down SHIFT or CTRL while mouse-wheeling. Can you try that?
I believe there are some more properties on MouseWheelZoomModifier which can be adjusted to change its behaviour.
/// <summary> /// Gets or sets the <see cref="ActionType"/> to perform on mouse-wheel interaction /// </summary> public ActionType ActionType { get { return (ActionType)GetValue(ActionTypeProperty); } set { SetValue(ActionTypeProperty, value); } }
where ActionType has values of Zoom, Pan. Try playing with that. If you have to you can also dynamically switch ActionType if the user is holding down CTRL.
Alternatively, you can create your own modifier! Our framework allows you to extend or create your own chart interations. Take a look at this forum post for inspiration
http://http://www.scichart.com/questions/question/different-zooming-on-axes/
Andrew
- Andrew Burnett-Thompson answered 10 years ago
- Thanks Andrew, this certainly helps. :-) The code of Ross gives me a good starting pointing for the zooming on an axis and your code sample on the same thread allows me to extend it to multiple X or Y axes. Nice ! Once that is done I can also add the panning, but actually the zooming on an axis was the most important for us. By the way, I tried the SHIFT and CTRL with the MouseWheelModifier and these keys pan the chart in the X or Y direction. Have a nice evening, Stefaan
- Great! Glad it helped you. Best regards, Andrew
- Hello Andrew, thanks again for the input ! I tried the ActionType but it only affects the behavior *without* the CTRL or SHIFT key being pressed. When one of these keys is pressed the MouseWheelZoomModifier is always doing panning, also when ActionType="Zoom" (at least with the version I am using, v2.3). Another solution for me might be to dynamically change the XyDirection when the user is holding CTRL or SHIFT. But I still go for the custom ChartModifier, the reason is that there are two YAxes (left and right) that the user wants to zoom independently and that works great with a quick and dirty adaptation :-) (until now it is only prototyping) of the code of Ross and you. Cheers, Stefaan
- You must login to post comments
Please login first to submit.