如何删除绘图oxyplot C#
How to delete plot oxyplot C#
我有一个氧图。当调用方法 "OnClearAll" 时,我希望这些图表消失/被删除。
我想要这样的东西:
private void OnClearAll()
{
HistoView.Clear();
}
但不存在。
我应该写什么来删除我的图表?
我的主面板xaml:
<oxy:PlotView x:Name ="HistoView" Model="{Binding HistogramModel}" Margin="476,304,102,459"/>
我的直方图class:
namespace myNameSpace
{
public class Histogram : INotifyPropertyChanged
{
//private Histogram DataContext;
public Collection<Item> Items { get; set; }
private PlotModel histogramModel;
public PlotModel HistogramModel //{ get; set; }
{
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);
}
尝试将 Model
或 DataContext
属性 设置为 null
:
private void OnClearAll()
{
HistoView.DataContext = null;
}
我有一个氧图。当调用方法 "OnClearAll" 时,我希望这些图表消失/被删除。
我想要这样的东西:
private void OnClearAll()
{
HistoView.Clear();
}
但不存在。
我应该写什么来删除我的图表?
我的主面板xaml:
<oxy:PlotView x:Name ="HistoView" Model="{Binding HistogramModel}" Margin="476,304,102,459"/>
我的直方图class:
namespace myNameSpace
{
public class Histogram : INotifyPropertyChanged
{
//private Histogram DataContext;
public Collection<Item> Items { get; set; }
private PlotModel histogramModel;
public PlotModel HistogramModel //{ get; set; }
{
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);
}
尝试将 Model
或 DataContext
属性 设置为 null
:
private void OnClearAll()
{
HistoView.DataContext = null;
}