Pre loader

Disable auto zoom when dragging graph horizontally

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Hi every one,
In order to pan and zoom the graph (from the example https://www.scichart.com/wpf-chart-example-pan-on-mouse-drag/ ), I used MouseWheelZoomModifier for zooming and ZoomPanModifier for panning.
The code is as below:

                <s:ZoomPanModifier x:Name="zoomPanModifier"
                                   ClipModeX="ClipAtExtents"
                                   ExecuteOn="MouseLeftButton"
                                   IsEnabled="True" />
            </s:ModifierGroup>

However, when I zoom out the graph and pan it horizontally, the graph auto stretch (auto zooming). That is not what I expected, I want disable this feature but I have no idea how to do it.

enter image description here

  • You must to post comments
0
0

Hi Quan,

When the MouseWheel zooms out beyond the VisibleRange of the series, then you use ZoomPanModifier, it clips to extents (by design). This is why you see the jumping.

You have two solutions:

  1. Prevent MouseWheelZoomModifier from zooming outside the range of the data. To do this, you can follow the steps from the scichart documentation on clipping visible range. I would recommend the technique from “Clipping Axis.VisibleRange in Code”

  2. You can write your own ZoomPanModifier to have the behaviour you desire. To do this, follow the steps from our tutorial on Creating a Custom Zoom Pan Modifier. You would need to detect if outside the Axis.DataRange and prevent panning.

These are the only ways to achieve what you want at the moment.

Best regards,
Andrew

  • Quan Tran
    Hi Andrew, Thanks for your answer. For the solutions I still have some consideration: 1. I don’t want to prevent MouseWheelZoomModifier from zooming outside the range of the data. It’s my expectation. 2. When I used function Scroll(), it still automatically zoom in with any ClipMode. And I don’t want to limit then DataRange of it. P/S: I see that we also have XAxisDragModifier, could it be the pan modifier? At the moment I don’t know how to make it work.
  • You must to post comments
0
0

Hi @Andrew,

Thanks for your answer. For the solutions I still have some consideration:

  1. I don’t want to prevent MouseWheelZoomModifier from zooming outside the range of the data. It’s my expectation.
  2. When I used function Scroll(), it still automatically zoom in with any ClipMode. And I don’t want to limit then DataRange of it.

P/S: I see that we also have XAxisDragModifier, could it be the pan modifier? At the moment I don’t know how to make it work.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies