Search code examples
c#wpfoxyplot

How can I reset only Y-axis/X-axis in OxyPlot


I am using OxyPlot for WPF. There is a function ResetAllAxes() which resets both axes. How can I reset only X or Y axis? Thanks


Solution

  • You can get all the axes from your plot model, then call the reset method on the axis you want. It helps if you set the key when you create the axis.

                var axis = PlotModel.Axes.First(x => x.Key.Equals("AxisKey"));
                axis.Reset();