// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) 2014 OxyPlot contributors
//
//
// HeatMapSeries Avalonia wrapper
//
// --------------------------------------------------------------------------------------------------------------------
using Avalonia;
namespace OxyPlot.Avalonia
{
using global::Avalonia.Media;
///
/// HeatMapSeries Avalonia wrapper
///
public class HeatMapSeries : XYAxisSeries
{
///
/// Identifies this dependency property.
///
public static readonly StyledProperty DataProperty = AvaloniaProperty.Register(nameof(Data), new double[0, 0], validate: val => val != null);
///
/// Identifies this dependency property.
///
public static readonly StyledProperty X0Property = AvaloniaProperty.Register(nameof(X0), default);
///
/// Identifies this dependency property.
///
public static readonly StyledProperty X1Property = AvaloniaProperty.Register(nameof(X1), default);
///
/// Identifies this dependency property.
///
public static readonly StyledProperty Y0Property = AvaloniaProperty.Register(nameof(Y0), default);
///
/// Identifies this dependency property.
///
public static readonly StyledProperty Y1Property = AvaloniaProperty.Register(nameof(Y1), default);
///
/// Identifies this dependency property.
///
public static readonly StyledProperty ColorAxisKeyProperty = AvaloniaProperty.Register(nameof(ColorAxisKey), default);
///
/// Identifies this dependency property.
///
public static readonly StyledProperty LowColorProperty = AvaloniaProperty.Register(nameof(LowColor), default);
///
/// Identifies this dependency property.
///
public static readonly StyledProperty HighColorProperty = AvaloniaProperty.Register(nameof(HighColor), default);
///
/// Initializes static members of the class.
///
static HeatMapSeries()
{
TrackerFormatStringProperty.OverrideMetadata(typeof(HeatMapSeries), new StyledPropertyMetadata(OxyPlot.Series.HeatMapSeries.DefaultTrackerFormatString));
DataProperty.Changed.AddClassHandler(DataChanged);
X0Property.Changed.AddClassHandler(AppearanceChanged);
X1Property.Changed.AddClassHandler(AppearanceChanged);
Y0Property.Changed.AddClassHandler(AppearanceChanged);
Y1Property.Changed.AddClassHandler(AppearanceChanged);
TrackerFormatStringProperty.Changed.AddClassHandler(AppearanceChanged);
}
///
/// Initializes a new instance of the class.
///
public HeatMapSeries()
{
Data = new double[0, 0];
InternalSeries = new OxyPlot.Series.HeatMapSeries { Data = Data };
}
///
/// Gets or sets LowColor
///
public Color LowColor
{
get
{
return GetValue(LowColorProperty);
}
set
{
SetValue(LowColorProperty, value);
}
}
///
/// Gets or sets HighColor
///
public Color HighColor
{
get
{
return GetValue(LowColorProperty);
}
set
{
SetValue(LowColorProperty, value);
}
}
///
/// Gets or sets ColorAxisKey property.
///
public string ColorAxisKey
{
get
{
return GetValue(ColorAxisKeyProperty);
}
set
{
SetValue(ColorAxisKeyProperty, value);
}
}
///
/// Gets or sets X0.
///
public double X0
{
get
{
return GetValue(X0Property);
}
set
{
SetValue(X0Property, value);
}
}
///
/// Gets or sets X1
///
public double X1
{
get
{
return GetValue(X1Property);
}
set
{
SetValue(X1Property, value);
}
}
///
/// Gets or sets Y0
///
public double Y0
{
get
{
return GetValue(Y0Property);
}
set
{
SetValue(Y0Property, value);
}
}
///
/// Gets or sets Y1
///
public double Y1
{
get
{
return GetValue(Y1Property);
}
set
{
SetValue(Y1Property, value);
}
}
///
/// Gets or sets Data
///
public double[,] Data
{
get
{
return GetValue(DataProperty);
}
set
{
SetValue(DataProperty, value);
}
}
///
/// The create model.
///
///
/// The .
///
public override OxyPlot.Series.Series CreateModel()
{
SynchronizeProperties(InternalSeries);
return InternalSeries;
}
///
/// The synchronize properties.
///
///
/// The series.
///
protected override void SynchronizeProperties(OxyPlot.Series.Series series)
{
base.SynchronizeProperties(series);
var s = (OxyPlot.Series.HeatMapSeries)series;
s.Data = Data ?? new double[0, 0];
s.X0 = X0;
s.X1 = X1;
s.Y0 = Y0;
s.Y1 = Y1;
}
}
}