RubberBandXyZoomModifier
SciChart for Android provides zooming via drag rectangle on a chart with the RubberBandXyZoomModifier.
Besides common features which are inherited from the ChartModifierBase class, the RubberBandXyZoomModifier defines a bunch of behavioral traits itself. Please find these in the table below:
| Feature | Description |
|---|---|
| isXAxisOnly | Allows to restrict zooming behavior to the X Axis only. |
| isAnimated | Allows to switch on / off the animation on zoom. |
| minDragSensitivity | Allows to specify the drag rectangle's minimal possible size. Rectangles smaller than this size in the diagonal will be ignored when zooming. |
| zoomExtentsY | Determines whether to perform zoom to extents on the Y Axis on the each zoom operation or not. |
| rubberBandStrokeStyle | Allows to assign an PenStyle object to the outline of the drag rectangle. Please refer to the PenStyle, BrushStyle and FontStyle article for more details. |
| rubberBandFillStyle | Allows to assign an BrushStyle object to fill the drag rectangle. Please refer to the PenStyle, BrushStyle and FontStyle article for more details. |
Adding a RubberBandXyZoomModifier to a Chart
Any Chart Modifier can be added to a SciChartSurface via the chartModifiers property and RubberBandXyZoomModifier is no difference:
// Assume a surface has been created and configured somewhere
// Create a RubberBandXyZoomModifier
RubberBandXyZoomModifier rubberBandZoomModifier = new RubberBandXyZoomModifier();
rubberBandZoomModifier.setIsXAxisOnly(true);
rubberBandZoomModifier.setZoomExtentsY(true);
rubberBandZoomModifier.setIsAnimated(true);
// Apply a BrushStyle for fill
BrushStyle brushStyle = new SolidBrushStyle(0x33999999);
rubberBandZoomModifier.setRubberBandFillStyle(brushStyle);
// Apply a PenStyle for stroke
PenStyle strokeStyle = new SolidPenStyle(0x77999999, true, 1f, null);
rubberBandZoomModifier.setRubberBandStrokeStyle(strokeStyle);
// Add the modifier to the surface
surface.getChartModifiers().add(rubberBandZoomModifier);
Including/Excluding Axes from RubberBandXyZoomModifier
You can include or exclude specific axes from being affected by the RubberBandXyZoomModifier. This is done by using the includeXAxis or includeYAxis method.
Below is an example of including/excluding axes from RubberBandXyZoomModifier.
// Assume a rubberBandXyZoomModifier has been created and configured somewhere
// To include/exclude an X axis in the rubberBandXyZoomModifier (true = include, false = exclude)
rubberBandXyZoomModifier.includeXAxis(xAxis, true);
rubberBandXyZoomModifier.includeXAxis(xAxis, false);
// To include/exclude an Y axis from the rubberBandXyZoomModifier (true = include, false = exclude)
rubberBandXyZoomModifier.includeYAxis(yAxis, true);
rubberBandXyZoomModifier.includeYAxis(yAxis, false);
// To include all X and Y axes to the rubberBandXyZoomModifier
rubberBandXyZoomModifier.includeAllAxes();
Note
To learn more about features available, please visit the Chart Modifier APIs article.