// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) 2014 OxyPlot contributors
//
//
// This is a Avalonia wrapper of OxyPlot.LogarithmicAxis.
//
// --------------------------------------------------------------------------------------------------------------------
using Avalonia;
namespace OxyPlot.Avalonia
{
///
/// This is a Avalonia wrapper of OxyPlot.LogarithmicAxis.
///
public class LogarithmicAxis : Axis
{
///
/// Identifies the dependency property.
///
/// The logarithmic base.
public static readonly StyledProperty BaseProperty = AvaloniaProperty.Register(nameof(Base), 10.0);
///
/// Identifies the dependency property.
///
public static readonly StyledProperty PowerPaddingProperty = AvaloniaProperty.Register(nameof(PowerPadding), true);
///
/// Initializes a new instance of the class.
///
public LogarithmicAxis()
{
InternalAxis = new Axes.LogarithmicAxis();
FilterMinValue = 0;
}
///
/// Gets or sets Base.
///
public double Base
{
get
{
return GetValue(BaseProperty);
}
set
{
SetValue(BaseProperty, value);
}
}
///
/// Gets or sets a value indicating whether the ActualMaximum and ActualMinimum values should be padded to the nearest power of the Base.
///
public bool PowerPadding
{
get
{
return GetValue(PowerPaddingProperty);
}
set
{
SetValue(PowerPaddingProperty, value);
}
}
///
/// Creates the internal axis.
///
/// The internal axis.
public override Axes.Axis CreateModel()
{
SynchronizeProperties();
return InternalAxis;
}
///
/// Synchronizes the properties.
///
protected override void SynchronizeProperties()
{
base.SynchronizeProperties();
var a = (Axes.LogarithmicAxis)InternalAxis;
a.Base = Base;
a.PowerPadding = PowerPadding;
}
static LogarithmicAxis()
{
BaseProperty.Changed.AddClassHandler(DataChanged);
PowerPaddingProperty.Changed.AddClassHandler(DataChanged);
}
}
}