using System.Windows.Forms;
using Core.Components.OxyPlot.Forms.Properties;
using OxyPlot;
using OxyPlot.Axes;
using OxyPlot.WindowsForms;
using TickStyle = OxyPlot.Axes.TickStyle;
namespace Core.Components.OxyPlot.Forms
{
internal sealed class LinearPlotView : PlotView
{
public LinearPlotView()
{
Dock = DockStyle.Fill;
Model = new PlotModel
{
Axes =
{
CreateAxis(Resources.BaseChart_XAxisTitle, AxisPosition.Bottom),
CreateAxis(Resources.BaseChart_YAxisTitle, AxisPosition.Left)
}
};
}
///
/// Creates an axis with default style set.
///
/// The title of the .
/// The of the .
/// A new with given and .
private static LinearAxis CreateAxis(string title, AxisPosition position)
{
return new LinearAxis
{
Title = title,
Position = position,
TickStyle = TickStyle.None,
ExtraGridlines = new[]
{
0.0
},
ExtraGridlineThickness = 1,
Layer = AxisLayer.AboveSeries,
MajorGridlineStyle = LineStyle.Solid,
MinorGridlineStyle = LineStyle.Dot
};
}
///
/// Zooms to a level so that everything is in view.
///
public void ZoomToAll()
{
Model.InvalidatePlot(true);
}
}
}