// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) 2014 OxyPlot contributors
//
//
// This is a Avalonia wrapper of OxyPlot.ScatterErrorSeries
//
// --------------------------------------------------------------------------------------------------------------------
using Avalonia;
namespace OxyPlot.Avalonia
{
using global::Avalonia.Media;
using OxyPlot.Series;
///
/// This is a Avalonia wrapper of OxyPlot.ScatterErrorSeries
///
public class ScatterErrorSeries : ScatterSeries
{
///
/// Identifies the dependency property.
///
public static readonly StyledProperty DataFieldErrorXProperty = AvaloniaProperty.Register(nameof(DataFieldErrorX), null);
///
/// Identifies the dependency property.
///
public static readonly StyledProperty DataFieldErrorYProperty = AvaloniaProperty.Register(nameof(DataFieldErrorY), null);
///
/// Identifies the dependency property.
///
public static readonly StyledProperty ErrorBarColorProperty = AvaloniaProperty.Register(nameof(ErrorBarColor), Colors.Black);
///
/// Identifies the dependency property.
///
public static readonly StyledProperty ErrorBarStopWidthProperty = AvaloniaProperty.Register(nameof(ErrorBarStopWidth), 4.0);
///
/// Identifies the dependency property.
///
public static readonly StyledProperty ErrorBarStrokeThicknessProperty = AvaloniaProperty.Register(nameof(ErrorBarStrokeThickness), 1.0);
///
/// Identifies the dependency property.
///
public static readonly StyledProperty MinimumErrorSizeProperty = AvaloniaProperty.Register(nameof(MinimumErrorSize), 0d);
///
/// Initializes a new instance of the class.
///
public ScatterErrorSeries()
{
InternalSeries = new OxyPlot.Series.ScatterErrorSeries();
}
///
/// Gets or sets the data field X error.
///
///
/// The data field error.
///
public string DataFieldErrorX
{
get { return GetValue(DataFieldErrorXProperty); }
set { SetValue(DataFieldErrorXProperty, value); }
}
///
/// Gets or sets the data field Y error.
///
///
/// The data field error.
///
public string DataFieldErrorY
{
get { return GetValue(DataFieldErrorYProperty); }
set { SetValue(DataFieldErrorYProperty, value); }
}
///
/// Gets or sets the color of the error bar.
///
///
/// The color of the error bar.
///
public Color ErrorBarColor
{
get { return GetValue(ErrorBarColorProperty); }
set { SetValue(ErrorBarColorProperty, value); }
}
///
/// Gets or sets the width of the error bar stop.
///
///
/// The width of the error bar stop.
///
public double ErrorBarStopWidth
{
get { return GetValue(ErrorBarStopWidthProperty); }
set { SetValue(ErrorBarStopWidthProperty, value); }
}
///
/// Gets or sets the error bar stroke thickness.
///
///
/// The error bar stroke thickness.
///
public double ErrorBarStrokeThickness
{
get { return GetValue(ErrorBarStrokeThicknessProperty); }
set { SetValue(ErrorBarStrokeThicknessProperty, value); }
}
///
/// Gets or sets the minimum size (relative to ) of the error bars to be shown.
///
public double MinimumErrorSize
{
get { return GetValue(MinimumErrorSizeProperty); }
set { SetValue(MinimumErrorSizeProperty, value); }
}
///
/// Synchronizes the properties.
///
/// The series.
protected override void SynchronizeProperties(OxyPlot.Series.Series series)
{
base.SynchronizeProperties(series);
var s = (OxyPlot.Series.ScatterErrorSeries)series;
s.DataFieldErrorX = DataFieldErrorX;
s.DataFieldErrorY = DataFieldErrorY;
s.ErrorBarColor = ErrorBarColor.ToOxyColor();
s.ErrorBarStopWidth = ErrorBarStopWidth;
s.ErrorBarStrokeThickness = ErrorBarStrokeThickness;
s.MinimumErrorSize = MinimumErrorSize;
}
static ScatterErrorSeries()
{
DataFieldErrorXProperty.Changed.AddClassHandler(DataChanged);
DataFieldErrorYProperty.Changed.AddClassHandler(DataChanged);
ErrorBarColorProperty.Changed.AddClassHandler(AppearanceChanged);
ErrorBarStopWidthProperty.Changed.AddClassHandler(AppearanceChanged);
ErrorBarStrokeThicknessProperty.Changed.AddClassHandler(AppearanceChanged);
MinimumErrorSizeProperty.Changed.AddClassHandler(AppearanceChanged);
}
}
}