// -------------------------------------------------------------------------------------------------------------------- // // Copyright (c) 2014 OxyPlot contributors // // // Base class for data series // // -------------------------------------------------------------------------------------------------------------------- using Avalonia; namespace OxyPlot.Avalonia { using System; /// /// Base class for data series /// public abstract class DataPointSeries : XYAxisSeries { /// /// Identifies the dependency property. /// public static readonly StyledProperty CanTrackerInterpolatePointsProperty = AvaloniaProperty.Register(nameof(CanTrackerInterpolatePoints), false); /// /// Identifies the dependency property. /// public static readonly StyledProperty DataFieldXProperty = AvaloniaProperty.Register(nameof(DataFieldX), null); /// /// Identifies the dependency property. /// public static readonly StyledProperty DataFieldYProperty = AvaloniaProperty.Register(nameof(DataFieldY), null); /// /// Identifies the dependency property. /// public static readonly StyledProperty> MappingProperty = AvaloniaProperty.Register>(nameof(Mapping)); /// /// Gets or sets a value indicating whether the tracker can interpolate points. /// public bool CanTrackerInterpolatePoints { get { return GetValue(CanTrackerInterpolatePointsProperty); } set { SetValue(CanTrackerInterpolatePointsProperty, value); } } /// /// Gets or sets DataFieldX. /// public string DataFieldX { get { return GetValue(DataFieldXProperty); } set { SetValue(DataFieldXProperty, value); } } /// /// Gets or sets DataFieldY. /// public string DataFieldY { get { return GetValue(DataFieldYProperty); } set { SetValue(DataFieldYProperty, value); } } /// /// Gets or sets the mapping. /// /// The mapping. public Func Mapping { get { return GetValue(MappingProperty); } set { SetValue(MappingProperty, value); } } /// /// Synchronizes the properties. /// /// The series. protected override void SynchronizeProperties(OxyPlot.Series.Series series) { base.SynchronizeProperties(series); var s = (OxyPlot.Series.DataPointSeries)series; s.ItemsSource = Items; s.DataFieldX = DataFieldX; s.DataFieldY = DataFieldY; s.CanTrackerInterpolatePoints = CanTrackerInterpolatePoints; s.Mapping = Mapping; } static DataPointSeries() { CanTrackerInterpolatePointsProperty.Changed.AddClassHandler(AppearanceChanged); DataFieldXProperty.Changed.AddClassHandler(DataChanged); DataFieldYProperty.Changed.AddClassHandler(DataChanged); } } }