// -------------------------------------------------------------------------------------------------------------------- // // Copyright (c) 2014 OxyPlot contributors // // // The Avalonia wrapper for OxyPlot.ThreeColorLineSeries. // // -------------------------------------------------------------------------------------------------------------------- using Avalonia; namespace OxyPlot.Avalonia { using global::Avalonia.Media; /// /// The Avalonia wrapper for OxyPlot.ThreeColorLineSeries. /// public class ThreeColorLineSeries : LineSeries { /// /// Identifies the dependency property. /// public static readonly StyledProperty ColorLoProperty = AvaloniaProperty.Register(nameof(ColorLo), Colors.Blue); /// /// Identifies the dependency property. /// public static readonly StyledProperty ColorHiProperty = AvaloniaProperty.Register(nameof(ColorHi), Colors.Red); /// /// Identifies the dependency property. /// public static readonly StyledProperty LimitLoProperty = AvaloniaProperty.Register(nameof(LimitLo), 0.0); /// /// Identifies the dependency property. /// public static readonly StyledProperty LimitHiProperty = AvaloniaProperty.Register(nameof(LimitHi), 0.0); /// /// Identifies the dependency property. /// public static readonly StyledProperty LineStyleLoProperty = AvaloniaProperty.Register(nameof(LineStyleLo), LineStyle.Solid); /// /// Identifies the dependency property. /// public static readonly StyledProperty LineStyleHiProperty = AvaloniaProperty.Register(nameof(LineStyleHi), LineStyle.Solid); /// /// Initializes a new instance of the class. /// public ThreeColorLineSeries() { InternalSeries = new OxyPlot.Series.ThreeColorLineSeries(); } /// /// Gets or sets ColorLo. /// public Color ColorLo { get { return GetValue(ColorLoProperty); } set { SetValue(ColorLoProperty, value); } } /// /// Gets or sets ColorHi. /// public Color ColorHi { get { return GetValue(ColorHiProperty); } set { SetValue(ColorHiProperty, value); } } /// /// Gets or sets LimitLo. /// public double LimitLo { get { return GetValue(LimitLoProperty); } set { SetValue(LimitLoProperty, value); } } /// /// Gets or sets LimitHi. /// public double LimitHi { get { return GetValue(LimitHiProperty); } set { SetValue(LimitHiProperty, value); } } /// /// Gets or sets LineStyleLo. /// public LineStyle LineStyleLo { get { return GetValue(LineStyleLoProperty); } set { SetValue(LineStyleLoProperty, value); } } /// /// Gets or sets LineStyleHi. /// public LineStyle LineStyleHi { get { return GetValue(LineStyleHiProperty); } set { SetValue(LineStyleHiProperty, value); } } /// /// Synchronizes the properties. /// /// The series. protected override void SynchronizeProperties(OxyPlot.Series.Series series) { base.SynchronizeProperties(series); var s = (OxyPlot.Series.ThreeColorLineSeries)series; s.LimitLo = LimitLo; s.ColorLo = ColorLo.ToOxyColor(); s.LimitHi = LimitHi; s.ColorHi = ColorHi.ToOxyColor(); } static ThreeColorLineSeries() { ColorLoProperty.Changed.AddClassHandler(AppearanceChanged); ColorHiProperty.Changed.AddClassHandler(AppearanceChanged); LimitLoProperty.Changed.AddClassHandler(AppearanceChanged); LimitHiProperty.Changed.AddClassHandler(AppearanceChanged); LineStyleLoProperty.Changed.AddClassHandler(AppearanceChanged); LineStyleHiProperty.Changed.AddClassHandler(AppearanceChanged); } } }