// -------------------------------------------------------------------------------------------------------------------- // // Copyright (c) 2014 OxyPlot contributors // // // This is a Avalonia wrapper of OxyPlot.StairStepSeries // // -------------------------------------------------------------------------------------------------------------------- using Avalonia; namespace OxyPlot.Avalonia { /// /// This is a Avalonia wrapper of OxyPlot.StairStepSeries /// public class StairStepSeries : LineSeries { /// /// Identifies the dependency property. /// public static readonly StyledProperty VerticalStrokeThicknessProperty = AvaloniaProperty.Register(nameof(VerticalStrokeThickness), double.NaN); /// /// Identifies the dependency property. /// public static readonly StyledProperty VerticalLineStyleProperty = AvaloniaProperty.Register(nameof(VerticalLineStyle), LineStyle.Automatic); /// /// Initializes a new instance of the class. /// public StairStepSeries() { InternalSeries = new OxyPlot.Series.StairStepSeries(); } /// /// Gets or sets the stroke thickness of the vertical line segments. /// /// The vertical stroke thickness. /// Set the value to NaN to use the StrokeThickness property for both horizontal and vertical segments. /// Using the VerticalStrokeThickness property will have a small performance hit. public double VerticalStrokeThickness { get { return GetValue(VerticalStrokeThicknessProperty); } set { SetValue(VerticalStrokeThicknessProperty, value); } } /// /// Gets or sets the line style of the vertical line segments. /// /// The vertical line style. public LineStyle VerticalLineStyle { get { return GetValue(VerticalLineStyleProperty); } set { SetValue(VerticalLineStyleProperty, value); } } /// /// Creates the internal series. /// /// /// The internal series. /// public override OxyPlot.Series.Series CreateModel() { SynchronizeProperties(InternalSeries); return InternalSeries; } /// /// Synchronizes the properties. /// /// The series. protected override void SynchronizeProperties(OxyPlot.Series.Series series) { base.SynchronizeProperties(series); var s = (OxyPlot.Series.StairStepSeries)series; s.VerticalLineStyle = VerticalLineStyle; s.VerticalStrokeThickness = VerticalStrokeThickness; } static StairStepSeries() { VerticalStrokeThicknessProperty.Changed.AddClassHandler(AppearanceChanged); VerticalLineStyleProperty.Changed.AddClassHandler(AppearanceChanged); } } }