Pre loader

Enabling Pan and pinch zoom in Android realtime charts

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

1
0

Hi,
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

Version
Trial
  • You must to post comments
0
0

Hi there,

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!

Best regards,
Yura

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.