// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) 2014 OxyPlot contributors
//
//
// This is a Avalonia wrapper of OxyPlot.AngleAxis.
//
// --------------------------------------------------------------------------------------------------------------------
using Avalonia;
namespace OxyPlot.Avalonia
{
using OxyPlot.Axes;
///
/// This is a Avalonia wrapper of OxyPlot.AngleAxis.
///
public class AngleAxis : LinearAxis
{
///
/// Identifies the dependency property.
///
public static readonly StyledProperty StartAngleProperty = AvaloniaProperty.Register(nameof(StartAngle), 0d);
///
/// Identifies the dependency property.
///
public static readonly StyledProperty EndAngleProperty = AvaloniaProperty.Register(nameof(EndAngle), 360d);
///
/// Initializes static members of the class.
///
static AngleAxis()
{
MajorGridlineStyleProperty.OverrideMetadata(typeof(AngleAxis), new StyledPropertyMetadata(LineStyle.Solid));
MinorGridlineStyleProperty.OverrideMetadata(typeof(AngleAxis), new StyledPropertyMetadata(LineStyle.Solid));
PositionProperty.OverrideMetadata(typeof(AngleAxis), new StyledPropertyMetadata(AxisPosition.None));
TickStyleProperty.OverrideMetadata(typeof(AngleAxis), new StyledPropertyMetadata(TickStyle.None));
IsPanEnabledProperty.OverrideMetadata(typeof(AngleAxis), new StyledPropertyMetadata(false));
IsZoomEnabledProperty.OverrideMetadata(typeof(AngleAxis), new StyledPropertyMetadata(false));
StartAngleProperty.Changed.AddClassHandler(AppearanceChanged);
EndAngleProperty.Changed.AddClassHandler(AppearanceChanged);
PositionProperty.Changed.AddClassHandler(AppearanceChanged);
TickStyleProperty.Changed.AddClassHandler(AppearanceChanged);
}
///
/// Initializes a new instance of the class.
///
public AngleAxis()
{
InternalAxis = new Axes.AngleAxis();
MajorGridlineStyle = LineStyle.Solid;
MinorGridlineStyle = LineStyle.Solid;
}
///
/// Gets or sets the start angle (degrees).
///
public double StartAngle
{
get { return GetValue(StartAngleProperty); }
set { SetValue(StartAngleProperty, value); }
}
///
/// Gets or sets the end angle (degrees).
///
public double EndAngle
{
get { return GetValue(EndAngleProperty); }
set { SetValue(EndAngleProperty, value); }
}
///
/// Synchronizes the properties.
///
protected override void SynchronizeProperties()
{
base.SynchronizeProperties();
var a = (Axes.AngleAxis)InternalAxis;
a.StartAngle = StartAngle;
a.EndAngle = EndAngle;
a.FractionUnitSymbol = FractionUnitSymbol;
}
}
}