Search Results for

    Show / Hide Table of Contents

    The XAxisDragModifier

    SciChart Android provides scale or pan an X Axis via the XAxisDragModifier, available out of the box.

    Besides common features which are inherited from the ChartModifierBase class, the XAxisDragModifier 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.
    • setClipModeX(ClipMode clipModeX) - allows to specify the behavior when scrolling reaches data extents in X direction via the ClipMode enumeration.
    • setClipModeTargetX(ClipModeTarget clipModeTargetX) - allows to specify which target is used as limit by clipModeX when you reach the edge of the X-Axis extents.

    Adding a XAxisDragModifier to a Chart

    Any Chart Modifier can be added to a SciChartSurface via the chartModifiers property and XAxisDragModifier is no difference:

    • Java
    • Java with Builders API
    • Kotlin
    // Assume a surface has been created and configured somewhere
    // Create a Modifier
    final XAxisDragModifier xAxisDragModifier = new XAxisDragModifier();
    xAxisDragModifier.setDragMode(AxisDragModifierBase.AxisDragMode.Pan);
    xAxisDragModifier.setClipModeX(ClipMode.StretchAtExtents);
    xAxisDragModifier.setClipModeTargetX(ClipModeTarget.MaximumRange);
    
    // Add the modifier to the surface
    surface.getChartModifiers().add(xAxisDragModifier);
    
    // Assume a surface has been created and configured somewhere
    // Create a Modifier
    final ModifierGroup xAxisDragModifierGroup = sciChartBuilder
            .newModifierGroup()
            .withXAxisDragModifier()
            .withDragMode(AxisDragModifierBase.AxisDragMode.Pan)
            .withClipModeX(ClipMode.StretchAtExtents)
            .withClipModeTargetX(ClipModeTarget.MaximumRange)
            .build()
            .build();
    
    // Add the modifier to the surface
    surface.getChartModifiers().add(xAxisDragModifierGroup);
    
    // Assume a surface has been created and configured somewhere
    // Create a Modifier
    val xAxisDragModifier = XAxisDragModifier()
    xAxisDragModifier.dragMode = AxisDragModifierBase.AxisDragMode.Pan
    xAxisDragModifier.clipModeX = ClipMode.StretchAtExtents
    xAxisDragModifier.clipModeTargetX = ClipModeTarget.MaximumRange
    
    // Add the modifier to the surface
    surface.chartModifiers.add(xAxisDragModifier)
    
    Note

    To learn more about features available, please visit the Chart Modifier APIs article.

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