// -------------------------------------------------------------------------------------------------------------------- // // Copyright (c) 2014 OxyPlot contributors // // // The Avalonia wrapper for OxyPlot.TwoColorLineSeries. // // -------------------------------------------------------------------------------------------------------------------- using Avalonia; namespace OxyPlot.Avalonia { using global::Avalonia.Media; /// /// The Avalonia wrapper for OxyPlot.TwoColorLineSeries. /// public class TwoColorLineSeries : LineSeries { /// /// Identifies the dependency property. /// public static readonly StyledProperty Color2Property = AvaloniaProperty.Register(nameof(Color2), Colors.Blue); /// /// Identifies the dependency property. /// public static readonly StyledProperty LimitProperty = AvaloniaProperty.Register(nameof(Limit), 0.0); /// /// Identifies the dependency property. /// public static readonly StyledProperty LineStyle2Property = AvaloniaProperty.Register(nameof(LineStyle2), LineStyle.Solid); /// /// Initializes a new instance of the class. /// public TwoColorLineSeries() { InternalSeries = new OxyPlot.Series.TwoColorLineSeries(); } /// /// Gets or sets Color2. /// public Color Color2 { get { return GetValue(Color2Property); } set { SetValue(Color2Property, value); } } /// /// Gets or sets Limit. /// public double Limit { get { return GetValue(LimitProperty); } set { SetValue(LimitProperty, value); } } /// /// Gets or sets LineStyle2. /// public LineStyle LineStyle2 { get { return GetValue(LineStyle2Property); } set { SetValue(LineStyle2Property, value); } } /// /// Synchronizes the properties. /// /// The series. protected override void SynchronizeProperties(OxyPlot.Series.Series series) { base.SynchronizeProperties(series); var s = (OxyPlot.Series.TwoColorLineSeries)series; s.Limit = Limit; s.Color2 = Color2.ToOxyColor(); } static TwoColorLineSeries() { Color2Property.Changed.AddClassHandler(AppearanceChanged); LimitProperty.Changed.AddClassHandler(AppearanceChanged); LineStyle2Property.Changed.AddClassHandler(AppearanceChanged); } } }