The YAxisDragModifier
SciChart Android provides scale or pan an X Axis via the YAxisDragModifier, available out of the box.
Besides common features which are inherited from the ChartModifierBase class, the YAxisDragModifier allows to control its specific features via the following properties:
- setDragMode(AxisDragModifierBase.AxisDragMode dragMode) - allows to change the default axis scaling behavior to axis panning behavior - similarly to ZoomPanModifier via the AxisDragModifierBase.AxisDragMode enumeration.
- setMinTouchArea(float minTouchArea) - configures the sensitivity of the modifier.
Adding a YAxisDragModifier to a Chart
Any Chart Modifier can be added to a SciChartSurface via the chartModifiers property and YAxisDragModifier is no difference:
// Assume a surface has been created and configured somewhere
// Create a Modifier
final YAxisDragModifier yAxisDragModifier = new YAxisDragModifier();
yAxisDragModifier.setDragMode(AxisDragModifierBase.AxisDragMode.Pan);
// Add the modifier to the surface
surface.getChartModifiers().add(yAxisDragModifier);
Including/Excluding Axes from YAxisDragModifier
You can include or exclude specific axes from being affected by the YAxisDragModifier. This is done by using the includeXAxis or includeYAxis method.
Below is an example of including/excluding axes from YAxisDragModifier.
// Assume a yAxisDragModifier has been created and configured somewhere
// To include/exclude an X axis in the yAxisDragModifier (true = include, false = exclude)
yAxisDragModifier.includeXAxis(xAxis, true);
yAxisDragModifier.includeXAxis(xAxis, false);
// To include/exclude an Y axis from the yAxisDragModifier (true = include, false = exclude)
yAxisDragModifier.includeYAxis(yAxis, true);
yAxisDragModifier.includeYAxis(yAxis, false);
// To include all X and Y axes to the yAxisDragModifier
yAxisDragModifier.includeAllAxes();
Note
To learn more about features available, please visit the Chart Modifier APIs article.