Search Results for

    Show / Hide Table of Contents

    SciChart Android Tutorial - Zooming and Panning Behavior

    So far, we have created a 2D chart, added X and Y Axes, asd well as Line and Scatter Series.

    In this SciChart Android tutorial we're going to add some interactivity to a 2D chart, so at the end we should be able to Zoom and Pan a chart as well as Zooming the Chart to the Data Extents.

    Getting Started

    This tutorial is suitable for Java and Kotlin.

    Note

    Source code for this tutorial can be found at our Github Repository: Java and Kotlin Tutorials Repository

    First of all, make sure, you've read the Tutorial 01 - Create a simple Chart 2D and have a basic understanding of how to use SciChart.

    Now, let's extend previous tutorial with some [Chart Modifiers](Chart Modifier APIs.html)

    ChartModifiers

    In SciChart, chart interactions are defined by the Chart Modifiers. In addition to the SciChart modifiers available out of the box, you can write custom modifiers or extends existing ones.

    Here is the list of modifiers available out of the box in SciChart:

    • ZoomExtentsModifier
    • PinchZoomModifier
    • ZoomPanModifier
    • XAxisDragModifier
    • YAxisDragModifier
    • SeriesSelectionModifier
    • TooltipModifier
    • RolloverModifier
    • CursorModifier
    • ModifierGroup
    • LegendModifier

    Adding Chart Modifiers

    Now we are going to create and configure a couple of modifiers and add a set of them as modifier collection of the SciChartSurface:

    • Java
    • Java with Builders API
    • Kotlin
    • Xamarin.Android
    Collections.addAll(
            surface.getChartModifiers(),
            new PinchZoomModifier(),
            new ZoomPanModifier(),
            new ZoomExtentsModifier()
    );
    
    Collections.addAll(
            surface.getChartModifiers(),
            new PinchZoomModifier(),
            new ZoomPanModifier(),
            new ZoomExtentsModifier()
    );
    
    Collections.addAll(
        surface.chartModifiers,
        PinchZoomModifier(),
        ZoomPanModifier(),
        ZoomExtentsModifier()
    )
    
    surface.ChartModifiers.Add(new PinchZoomModifier());
    surface.ChartModifiers.Add(new ZoomPanModifier());
    surface.ChartModifiers.Add(new ZoomExtentsModifier());
    

    After running the application the chart should behave like below:

    Where to Go From Here?

    You can download the final project from our Java and Kotlin Tutorials Repository.

    Also, you can found next tutorial from this series here - SciChart Android Tutorial - Tooltips and Legends

    Of course, this is not the maximum of what you can achieve with the SciChart Android. You can find more information about modifiers which are used in this tutorial in the articles below:

    • Zoom Extents Modifier
    • Pinch Zoom Modifier
    • Zoom Pan Modifier

    Also, you might want to read about Axes drag modifiers in the following articles:

    • X Axis Drag Modifier
    • Y Axis Drag Modifier

    Finally, start exploring. The SciChart Android library and functionality is quite extensive. You can look into our SciChart Android Examples Suite which are full of 2D and 3D examples, which are also available on our GitHub

    Back to top © 2011-2025 SciChart. All rights reserved. | sitemap.xml