如何重设缩放oxyplot C#WPF

Eme*_*lie 2 c# wpf oxyplot

我有一个oxyplot RectangleBarSeries和一个按钮“ Reset”。当我按下按钮时,我想重置缩放(以相同的方式,当在键盘上按A时,缩放重置)。

我试图通过在MainPanel.xaml.cs中添加带有以下代码的事件处理程序来实现此目的:

private void Reset_Click(object sender, RoutedEventArgs e)
    {
       histogram.PlotModel.Axes[0].Reset();
       histogram.PlotModel.Axes[1].Reset(); 
    } 
Run Code Online (Sandbox Code Playgroud)

但是出现错误“ myNameSpace.Histogram不包含PlotModel的定义,并且找不到扩展方法“ PlotModel”接受类型为myNameSpace.Histogram的第一个参数”。

我应该写些什么才能重置绘图的缩放比例?

我的直方图课程的一部分:

namespace myNameSpace
{
    public class Histogram : INotifyPropertyChanged
    {
    public Collection<Item> Items { get; set; }
    private PlotModel histogramModel;
    public PlotModel HistogramModel
    {
        get { return histogramModel; }
        set { histogramModel = value; OnPropertyChanged("HistogramModel"); }
    }

    public class Item
    {
        public string Label { get; set; }
        public double Value { get; set; }
    }

    public event PropertyChangedEventHandler PropertyChanged;

    //NotifyPropertyChangedInvocator
    protected virtual void OnPropertyChanged(string propertyName)
    {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
        {
            handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    public Histogram(List<double> frequency, List<double> axis, string VariableName)
    {
        CreateRectangleBar(frequency, axis, VariableName);
    }
Run Code Online (Sandbox Code Playgroud)

Ann*_*nna 5

尝试使用MyPlotViewName.ResetAllAxes(); 而是应该起作用。