Search code examples
c#.netwpflivecharts

Live Charts, How do i make the graph to follow the last data updates after changing zoom


How do i make Live Charts graph to show the last update after changing zoom https://i.sstatic.net/fECsZ.png


Solution

  • I face the same problem after zooming and panning. My way is to let the user reset the zoom and panning when they are done looking at the point they want. I did it in code behind when the reset button is clicked.

                 private void btn_Reset_Click(object sender, RoutedEventArgs e)
                    {    
                          foreach (var XAxis in ConstantChangeCartesianChart.AxisX)                    
                          {
                            XAxis.MinValue = double.NaN;
                            XAxis.SetRange(double.NaN, double.NaN);
                          }
                          foreach (var YAxis in ConstantChangeCartesianChart.AxisX)
                          {
                            YAxis.MinValue = double.NaN;
                            YAxis.SetRange(double.NaN, double.NaN);
                          }
                    }
    

    This will simply reset all the range and minimum value. Hope this help.