SciChart for Android provides pinch zooming via the PinchZoomModifier, available out of the box.
Besides common features which are inherited from the ChartModifierBase class, the PinchZoomModifier allows to set ScaleFactor to change zooming speed. This can be done via the getScaleFactor() / setScaleFactor() methods. Also, it allows to restrict zooming to the horizontal or vertical direction only, via the getDirection() / setDirection() methods.
Adding a PinchZoomModifier to a Chart
A ChartModifier can be added to a ChartModifiersCollection of a SciChartSurface via the getChartModifiers() / setChartModifiers() methods. This can be done using the code below:
Copy Code | |
---|---|
// Assume the surface has been created and configured earlier ISciChartSurface surface; // Create a PinchZoomModifier PinchZoomModifier pinchZoomModifier = new PinchZoomModifier(); pinchZoomModifier.setScaleFactor(1.5f); pinchZoomModifier.setDirection(Direction2D.XDirection); // Add the modifier to the surface surface.getChartModifiers().add(pinchZoomModifier); |
Also a PinchZoomModifier can be created using Chart Builders. To learn more about features available, Please refer to the Common ChartModifiers Features article.