[英]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.