SciChart Android 2D Charts API > ChartModifier API > Zooming and Panning > ZoomExtentsModifier
ZoomExtentsModifier

SciChart for Android provides the ability to zoom-to-fit the entire chart double-tapping it via the ZoomExtentsModifier, available out of the box.

Besides common features which are inherited from the ChartModifierBase class, the ZoomExtentsModifier allows to restrict zooming behavior to the horizontal or vertical direction only, via the getDirection()setDirection() methods. It is possible to switch on / off the animation on zoom out via the setIsAnimated() method.

Also, the setExecuteOn() method allows to specify the trigger action for the modifier. There are several modes defined by the ExecuteOn enumeration.

Adding a ZoomExtentsModifier 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 ZoomExtentsModifier
ZoomExtentsModifier zoomExtentsModifier = new ZoomExtentsModifier();
zoomExtentsModifier.setDirection(Direction2D.XyDirection);
zoomExtentsModifier.setExecuteOn(ExecuteOn.LongPress);
zoomExtentsModifier.setIsAnimated(true);

// Add the modifier to the surface
surface.getChartModifiers().add(zoomExtentsModifier);

Also a ZoomExtentsModifier can be created using Chart Builders. To learn more about features available, Please refer to the Common ChartModifiers Features article.

See Also