SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

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.

  • Andrew
    It clips even when you call AxisBase.Scroll(pixels, ClipMode.None)?
  • Quan Tran
    Yes, indeed.
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.