Pre loader

Changing between ZoomExtents and Manually setting the VisibleRange

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums



After the chart is added with data I want to switch between using the ZoomExtents method and manually setting the AutoRange = Never and setting the VisibleRange. It works using either of them, but after using the ZoomExtents method the axis range is never adjusted to the VisibleRange. Am I doing something wrong or is not possible ?

Using SciChart 3.1.0

Best regards

  • You must to post comments
Best Answer

OK i think there is a really simple solution to this

Please see Axis.VisibleRange – a Note about Dependency Property Precedence

AxisBase.VisibleRange is a DependencyProperty, it is therefore subject to Dependency Property Precedence in WPF. See the MSDN Documentation for more details.

Internally, SciChart sets the AxisBase.VisibleRangeProperty using the
Local Value precedence in some places. We must do this as
ChartModifiers, and AutoRange need to update the

This means that in some cases, style setters and templated properties
setting Axis.VisibleRange will not appear to work. For this reason we
recommend that any bindings to VisibleRange are a TwoWay binding to a
ViewModel property:

  <s:NumericAxis VisibleRange="{Binding AxisVisibleRange, Mode=TwoWay}"/>
  • Marius Mathisen
    Thank you very much Andrew! Simple solution and it works! : - )
  • You must to post comments

Hi Marius,

The first thing I would say is ‘does the problem occur in the latest version?’. v3.1 was released almost a year ago and a lot of bugs have been fixed since then. See our release notes to see how busy we’ve been!

Secondly, the way to switch between AutoRange.Always and AutoRange.Never is to handle a click event and and set the AxisBase.AutoRange property, e.g. imagine this workflow:

  1. Set chart AutoRange.Always, the chart always zooms to fit the data
  2. On mouse-down of a chart, set AutoRange.Never. Now allow the user to zoom and pan using our modifiers
  3. On mouse-double-click of a chart, set AutoRange.Always again

This way the user can always interact with an autoranged-chart and simply double-clicking resets the behaviour back to autorange after they have zoomed and panned.

Have a look at these related FAQs as they may also give you some ideas.

Best regards,

  • You must to post comments

Hi Andrew,

Thank you very much for your quick response!

I am now using latest version 3.5 and having the same issues.

  1. Adding dummy data, setting AutoRange = Never and VisibleRange = -1,1 Works!
  2. Clicking button, setting AutoRange = Never and VisibleRange = -100,100 Works!
  3. Zooming or double click to fit (using modifiers) Works!
  4. Clicking button, setting AutoRange = Never and VisibleRange = -100,100 DO NOT WORK!

If I use the modifiers or uses the ZoomExtents I am not able to manually set the VisibleRange.

Best regards

Test project:

Code behind:

public partial class MainWindow
    public ViewModel ViewModel { get; set; }
    public MainWindow()
        ViewModel = new ViewModel
                AutoRange = AutoRange.Once,
                VisibleRange = new DoubleRange(0, 0),
                ChartSeries = new ObservableCollection<IChartSeriesViewModel>()


        var data = new List<double> { 0, 2, 4, 6, 8 };

        var chartData = new XyDataSeries<double, double>();
        for (var i = 0; i < data.Count; i++)
            chartData.Append(i, i);

        var fastLineSeries = new FastLineRenderableSeries
            SeriesColor = Colors.Red,
            StrokeThickness = 1,
            PointMarker = new EllipsePointMarker { Width = 7, Height = 7, Fill = Colors.Yellow }

        var chartSerie = new ChartSeriesViewModel(chartData, fastLineSeries);
        ViewModel.AutoRange = AutoRange.Never;
        ViewModel.VisibleRange = new DoubleRange(-1, 1);

    private void ButtonChange_OnClick(object sender, RoutedEventArgs e)
        ViewModel.AutoRange = AutoRange.Never;
        ViewModel.VisibleRange = new DoubleRange(-100, 100);


    <Style x:Key="SciChartSurfaceStyle" TargetType="s:SciChartSurface">
        <Setter Property="Background" Value="WhiteSmoke"/>
        <Setter Property="Padding" Value="20"/>
        <Setter Property="Foreground" Value="DarkOrchid"/>
        <Setter Property="FontSize" Value="20"/>
        <Setter Property="FontFamily" Value="Arial Black"/>
        <Setter Property="FontWeight" Value="Bold"/>
    <Style x:Key="GridLinesPanelStyle" TargetType="s:GridLinesPanel">
        <Setter Property="Background" Value="White"/>
        <Setter Property="BorderThickness" Value="2"/>
        <Setter Property="BorderBrush" Value="SteelBlue"/>

        <RowDefinition Height="30"></RowDefinition>
        <RowDefinition Height="30"></RowDefinition>
        <RowDefinition Height="*"></RowDefinition>
    <DockPanel Grid.Row="0">
        <Button Click="ButtonChange_OnClick">Set VisibleRange</Button>
    <GroupBox Header="Graph" Grid.Row="2">
            SeriesSource="{Binding Path=ViewModel.ChartSeries}"
            Style="{StaticResource SciChartSurfaceStyle}"
            GridLinesPanelStyle="{StaticResource GridLinesPanelStyle}"
                <s:NumericAxis AxisAlignment="Bottom" BorderThickness="0,1,0,0"/>

                <s:NumericAxis x:Name="NumericYAxes"
                    AxisAlignment="Left" BorderBrush="White" BorderThickness="1,0,0,0"
                               AutoRange="{Binding Path=ViewModel.AutoRange}"
                               VisibleRange="{Binding Path=ViewModel.VisibleRange}"
                               GrowBy="{Binding Path=ViewModel.YAxisGrowBy}"/>

                    <s:RubberBandXyZoomModifier IsEnabled="True" IsXAxisOnly="False" ZoomExtentsY="False" IsAnimated="True"/>
                    <s:ZoomExtentsModifier ExecuteOn="MouseDoubleClick"/>
                    <s:ZoomPanModifier IsEnabled="True" ExecuteOn="MouseRightButton"/>


  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.