SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!
I am trying to implement pan and zoom functionalities for real time charts present in Sci chart demo application
Can any one please suggest me on how to implement the same
Thanks in advance
Well to implement desired behavior you just need to add apporpriate modifiers into chart modifier collection of the chart. If you use our builder helper classes then code should be similar to this:
surface.getChartModifiers().add(sciChartBuilder.newModifierGroup() .withXAxisDragModifier().build() .withZoomPanModifier().build() .withZoomExtentsModifier().build() .build());
If you don’t use helpers then code should be something like this:
final PinchZoomModifier pinchZoomModifier = new PinchZoomModifier(); final ZoomPanModifier zoomPanModifier = new ZoomPanModifier(); final ZoomExtentsModifier zoomExtentsModifier = new ZoomExtentsModifier(); final ModifierGroup modifierGroup = new ModifierGroup(pinchZoomModifier, zoomPanModifier, zoomExtentsModifier); surface.getChartModifiers().add(modifierGroup);
That’s basically all code you need to add for both realtime and non-realtime charts to add zoom and pan functionality.
If for some reasons those modifiers don’t work then I would suggest you to check AutoRange mode for you axes. Because if you set AutoRange.Always for axis then all changes made by modifiers will be discarded because in this case axis is forced to show entire data range and ignore any changes applied to its VisibleRange.
If you need to behavior which is similar to AutoRange.Always effect and need to be able to scroll then you’ll need to handle VisibleRange in your code. If you need more information about how to do this then I would suggest to take a look on our Realtime Ticking Stock Charts example.
Hope this will help you!
Please login first to submit.