Search Results for

    Show / Hide Table of Contents

    Axis Ranging - AutoRange

    At the outset, the VisibleRange is adjusted to be equal to the DataRange of an axis. However, an axis won't adjust its VisibleRange automatically when data changes, unless it is configured to do this. The default behavior can be changed by applying different AutoRange modes on setAutoRange(AutoRange autoRange).

    Note

    Setting an explicit setVisibleRange(IRange visibleRange) on the axis will override this behaviour.

    AutoRange Once

    This is the default setting. The axis will attempt to autorange once to fit the data as you start the chart. This is a one-time action - the setVisibleRange(IRange visibleRange) won't adjust to any data changes in future.

    • Java
    • Java with Builders API
    • Kotlin
    final NumericAxis axis = new NumericAxis(getContext());
    axis.setAutoRange(AutoRange.Once);
    
    final NumericAxis axis = sciChartBuilder.newNumericAxis()
            .withAutoRangeMode(AutoRange.Once)
            .build();
    
    val axis = NumericAxis(context)
    axis.autoRange = AutoRange.Once
    

    AutoRange Always

    In this mode, the axis will attempt to autorange always to fit the data every time the chart is drawn. The VisibleRange will adjust to data changes correspondingly.

    Note

    Please be aware that this setting will override any other ranging, including zooming and panning by modifiers, but is useful in situations where you always want to view the extents of the data.

    • Java
    • Java with Builders API
    • Kotlin
    final NumericAxis axis = new NumericAxis(getContext());
    axis.setAutoRange(AutoRange.Always);
    
    final NumericAxis axis = sciChartBuilder.newNumericAxis()
            .withAutoRangeMode(AutoRange.Always)
            .build();
    
    val axis = NumericAxis(context)
    axis.autoRange = AutoRange.Always
    

    AutoRange Never

    The axis will never autorange. With this option, you would need to set the setVisibleRange(IRange visibleRange) manually. The VisibleRange won't adjust to any data changes.

    • Java
    • Java with Builders API
    • Kotlin
    final NumericAxis axis = new NumericAxis(getContext());
    axis.setAutoRange(AutoRange.Never);
    
    final NumericAxis axis = sciChartBuilder.newNumericAxis()
            .withAutoRangeMode(AutoRange.Never)
            .build();
    
    val axis = NumericAxis(context)
    axis.autoRange = AutoRange.Never
    

    Using ViewportManager

    The AutoRange behavior can be completely overridden if necessary. The IViewportManager provides the full access to and control over axis ranges and viewport. The default implementation of IViewportManager is the DefaultViewportManager class. Custom ViewportManagers can be assigned via viewportManager property.

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