簡體   English   中英

如何重設縮放oxyplot C#WPF

[英]How to reset zoom oxyplot c# wpf

我有一個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(); 
    } 

但出現錯誤“ 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);
    }

嘗試使用MyPlotViewName.ResetAllAxes(); 相反,那應該起作用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM