// -------------------------------------------------------------------------------------------------------------------- // // Copyright (c) 2014 OxyPlot contributors // // // This is a Avalonia wrapper of OxyPlot.Series.LinearBarSeries // // -------------------------------------------------------------------------------------------------------------------- using Avalonia; namespace OxyPlot.Avalonia { using global::Avalonia.Media; /// /// This is a Avalonia wrapper of OxyPlot.Series.LinearBarSeries /// public class LinearBarSeries : DataPointSeries { /// /// Identifies the dependency property. /// public static readonly StyledProperty BarWidthProperty = AvaloniaProperty.Register(nameof(BarWidth), 1.0); /// /// Identifies the dependency property. /// public static readonly StyledProperty FillColorProperty = AvaloniaProperty.Register(nameof(FillColor), MoreColors.Automatic); /// /// Identifies the dependency property. /// public static readonly StyledProperty StrokeColorProperty = AvaloniaProperty.Register(nameof(StrokeColor), Colors.Black); /// /// Identifies the dependency property. /// public static readonly StyledProperty StrokeThicknessProperty = AvaloniaProperty.Register(nameof(StrokeThickness), 1.0); /// /// Identifies the dependency property. /// public static readonly StyledProperty NegativeFillColorProperty = AvaloniaProperty.Register(nameof(NegativeFillColor), MoreColors.Undefined); /// /// Identifies the dependency property. /// public static readonly StyledProperty NegativeStrokeColorProperty = AvaloniaProperty.Register(nameof(NegativeStrokeColor), MoreColors.Undefined); /// /// Initializes a new instance of the class. /// public LinearBarSeries() { InternalSeries = new OxyPlot.Series.LinearBarSeries(); } /// /// Gets or sets the bar width. /// public double BarWidth { get { return GetValue(BarWidthProperty); } set { SetValue(BarWidthProperty, value); } } /// /// Gets or sets the fill color. /// public Color FillColor { get { return GetValue(FillColorProperty); } set { SetValue(FillColorProperty, value); } } /// /// Gets or sets the stroke color. /// public Color StrokeColor { get { return GetValue(StrokeColorProperty); } set { SetValue(StrokeColorProperty, value); } } /// /// Gets or sets the stroke thickness. /// public double StrokeThickness { get { return GetValue(StrokeThicknessProperty); } set { SetValue(StrokeThicknessProperty, value); } } /// /// Gets or sets the negative fill color. /// public Color NegativeFillColor { get { return GetValue(NegativeFillColorProperty); } set { SetValue(NegativeFillColorProperty, value); } } /// /// Gets or sets the negative stroke color. /// public Color NegativeStrokeColor { get { return GetValue(NegativeStrokeColorProperty); } set { SetValue(NegativeStrokeColorProperty, 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.LinearBarSeries)series; s.BarWidth = BarWidth; s.FillColor = FillColor.ToOxyColor(); s.StrokeColor = StrokeColor.ToOxyColor(); s.StrokeThickness = StrokeThickness; s.NegativeFillColor = NegativeFillColor.ToOxyColor(); s.NegativeStrokeColor = NegativeStrokeColor.ToOxyColor(); } static LinearBarSeries() { BarWidthProperty.Changed.AddClassHandler(AppearanceChanged); FillColorProperty.Changed.AddClassHandler(AppearanceChanged); StrokeColorProperty.Changed.AddClassHandler(AppearanceChanged); StrokeThicknessProperty.Changed.AddClassHandler(AppearanceChanged); NegativeFillColorProperty.Changed.AddClassHandler(AppearanceChanged); NegativeStrokeColorProperty.Changed.AddClassHandler(AppearanceChanged); } } }