Search Results for

    Show / Hide Table of Contents

    Zoom Extents Modifier 3D

    SciChart Android 3D provides the ability to zoom-to-fit the entire 3D chart by double-tapping it via the ZoomExtentsModifier3D, available out of the box.

    Besides common features which are inherited from the ChartModifierBase3D class, the ZoomExtentsModifier3D allows to control its specific features via the following properties:

    • setResetTarget(Vector3 resetTarget) - defines the Vector3 target where the setTarget(Vector3 target) is moved on reset.
    • setResetPosition(Vector3 resetPosition) - defines the Vector3 target where the setPosition(Vector3 position) is moved on reset.
    • setExecuteOn(ExecuteOn executeOn) - allows to specify the trigger action for the modifier via the ExecuteOn enumeration.
    • setAutoFitRadius(boolean autoFitRadius) - When true, attempts to auto-fit the camera radius to fit the scene. When false - uses the setResetPosition(Vector3 resetPosition) and setResetTarget(Vector3 resetTarget) instead.
    • setAnimationDuration(long animationDuration) - defines the animation duration in long for any zoom operations.
    Note

    There are several modes defined by the ExecuteOn enumeration, such as Single Tap, Double Tap, Long Press, and Fling.

    There are two modes of operation for the ZoomExtentsModifier3D - AutoFit and Manual:

    Operation Mode Description
    autoFitRadius = true Tries to automatically fit the 3D scene into the viewport. getTarget() and getPosition() methods are ignored.
    autoFitRadius = false You should specify the precise coordinates in the setTarget(Vector3 target) and setPosition(Vector3 position) methods.

    Adding a ZoomExtentsModifier to a Chart

    Any Chart Modifier 3D can be added to a SciChartSurface3D via the chartModifiers property and ZoomExtentsModifier3D is no difference:

    • Java
    • Java with Builders API
    • Kotlin
    // Assume a surface has been created and configured somewhere
    // Create a Modifier
    final ZoomExtentsModifier3D zoomExtentsModifier = new ZoomExtentsModifier3D();
    zoomExtentsModifier.setExecuteOn(ExecuteOn.DoubleTap);
    zoomExtentsModifier.setAutoFitRadius(false);
    zoomExtentsModifier.setResetPosition(new Vector3(200, 200, 200));
    zoomExtentsModifier.setResetTarget(new Vector3(0, 0, 0));
    
    // Add the modifier to the surface
    surface.getChartModifiers().add(zoomExtentsModifier);
    
    // Assume a surface has been created and configured somewhere
    // Create a Modifier
    final ZoomExtentsModifier3D zoomExtentsModifier = new ZoomExtentsModifier3D();
    zoomExtentsModifier.setExecuteOn(ExecuteOn.DoubleTap);
    zoomExtentsModifier.setAutoFitRadius(false);
    zoomExtentsModifier.setResetPosition(new Vector3(200, 200, 200));
    zoomExtentsModifier.setResetTarget(new Vector3(0, 0, 0));
    
    // Add the modifier to the surface
    surface.getChartModifiers().add(zoomExtentsModifier);
    
    // Assume a surface has been created and configured somewhere
    // Create a Modifier
    val zoomExtentsModifier = ZoomExtentsModifier3D()
    zoomExtentsModifier.executeOn = ExecuteOn.DoubleTap
    zoomExtentsModifier.autoFitRadius = false
    zoomExtentsModifier.resetPosition = Vector3(200f, 200f, 200f)
    zoomExtentsModifier.resetTarget = Vector3(0f, 0f, 0f)
    
    // Add the modifier to the surface
    surface.chartModifiers.add(zoomExtentsModifier)
    
    Note

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

    Programmatically Zoom to Extents

    You can also run Zoom to Extents functionality programmatically without adding ZoomExtentsModifier3D. The Camera3D object which is associated with SciChartSurface3D provides the following methods which you can call whenever you need to zoom the chart to fit:

    • zoomToFit()
    • animateZoomToFit(long duration)
    • zoomToFit(Vector3 resetPosition)
    • animateZoomToFit(Vector3 resetPosition, long duration)
    • animate(Vector3 position, Vector3 target, long duration)
    Back to top © 2011-2025 SciChart. All rights reserved. | sitemap.xml