using Core.Components.OxyPlot.Properties;
using OxyPlot;
using OxyPlot.Axes;
using OxyPlot.WindowsForms;
namespace Core.Components.OxyPlot
{
public class BaseChart : PlotView
{
private LinearAxis xAxis;
private LinearAxis yAxis;
///
/// Creates a new instance of .
///
public BaseChart()
{
Model = new PlotModel();
InitializeAxes();
InitializeDefaultStyle();
}
///
/// Sets the default look and feel of the
///
private void InitializeDefaultStyle()
{
xAxis.MajorGridlineStyle = LineStyle.Solid;
xAxis.MinorGridlineStyle = LineStyle.Dot;
yAxis.MajorGridlineStyle = LineStyle.Solid;
yAxis.MinorGridlineStyle = LineStyle.Dot;
}
///
/// Sets up default axes representations.
///
private void InitializeAxes()
{
xAxis = new LinearAxis
{
Title = Resources.BaseChart_XAxisTitle,
Position = AxisPosition.Bottom,
TickStyle = TickStyle.None
};
yAxis = new LinearAxis
{
Title = Resources.BaseChart_YAxisTitle,
TickStyle = TickStyle.None
};
Model.Axes.Add(xAxis);
Model.Axes.Add(yAxis);
}
///
/// Add to the .
///
///
public void AddData(ChartData data)
{
data.AddTo(Model);
}
///
/// Remove all the that has been added to the .
///
public void ClearData()
{
Model.Series.Clear();
}
}
}