Merge pull request #18 from dotnet-standard-ui/dev/erikd/ChartHierarchy
Change hand-generated Chart classes to derive from each other
This commit is contained in:
Коммит
8f74cca727
|
@ -7,11 +7,9 @@ using System.Globalization;
|
|||
using System.Linq;
|
||||
using Microsoft.StandardUI;
|
||||
using Microsoft.StandardUI.Controls;
|
||||
using Microsoft.StandardUI.Media;
|
||||
using Microsoft.StandardUI.Shapes;
|
||||
using static Microsoft.StandardUI.FactoryStatics;
|
||||
using SkiaSharp;
|
||||
using SkiaSharp.HarfBuzz;
|
||||
using Microsoft.StandardUI.Media;
|
||||
|
||||
namespace Microcharts
|
||||
{
|
||||
|
|
|
@ -1,49 +1,14 @@
|
|||
// This code will eventually be generated.
|
||||
|
||||
using Microsoft.StandardUI.Wpf;
|
||||
using Microcharts;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.StandardUI;
|
||||
|
||||
namespace SimpleControls.Wpf
|
||||
{
|
||||
public class BarChart : StandardControl, IBarChart
|
||||
public class BarChart : PointChart, IBarChart
|
||||
{
|
||||
public static readonly System.Windows.DependencyProperty EntriesProperty = PropertyUtils.Register(nameof(Entries), typeof(IEnumerable<ChartEntry>), typeof(BarChart), null);
|
||||
public static readonly System.Windows.DependencyProperty BackgroundColorProperty = PropertyUtils.Register(nameof(BackgroundColor), typeof(ColorWpf), typeof(BarChart), ColorWpf.Default);
|
||||
public static readonly System.Windows.DependencyProperty LabelColorProperty = PropertyUtils.Register(nameof(LabelColor), typeof(ColorWpf), typeof(BarChart), ColorWpf.Default);
|
||||
|
||||
public BarChart()
|
||||
{
|
||||
InitImplementation(new BarChartImplementation<IBarChart>(this));
|
||||
}
|
||||
|
||||
public IEnumerable<ChartEntry> Entries
|
||||
{
|
||||
get => (IEnumerable<ChartEntry>)GetValue(EntriesProperty);
|
||||
set => SetValue(EntriesProperty, value);
|
||||
}
|
||||
|
||||
public ColorWpf BackgroundColor
|
||||
{
|
||||
get => (ColorWpf)GetValue(BackgroundColorProperty);
|
||||
set => SetValue(BackgroundColorProperty, value);
|
||||
}
|
||||
Color IChart.BackgroundColor
|
||||
{
|
||||
get => BackgroundColor.Color;
|
||||
set => BackgroundColor = new ColorWpf(value);
|
||||
}
|
||||
|
||||
public ColorWpf LabelColor
|
||||
{
|
||||
get => (ColorWpf)GetValue(LabelColorProperty);
|
||||
set => SetValue(LabelColorProperty, value);
|
||||
}
|
||||
Color IChart.LabelColor
|
||||
{
|
||||
get => LabelColor.Color;
|
||||
set => LabelColor = new ColorWpf(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
// This code will eventually be generated.
|
||||
|
||||
using Microsoft.StandardUI.Wpf;
|
||||
using Microcharts;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.StandardUI;
|
||||
|
||||
namespace SimpleControls.Wpf
|
||||
{
|
||||
public abstract class Chart : StandardControl, IChart
|
||||
{
|
||||
public static readonly System.Windows.DependencyProperty EntriesProperty = PropertyUtils.Register(nameof(Entries), typeof(IEnumerable<ChartEntry>), typeof(Chart), null);
|
||||
public static readonly System.Windows.DependencyProperty BackgroundColorProperty = PropertyUtils.Register(nameof(BackgroundColor), typeof(ColorWpf), typeof(Chart), ColorWpf.Default);
|
||||
public static readonly System.Windows.DependencyProperty LabelColorProperty = PropertyUtils.Register(nameof(LabelColor), typeof(ColorWpf), typeof(Chart), ColorWpf.Default);
|
||||
|
||||
public IEnumerable<ChartEntry> Entries
|
||||
{
|
||||
get => (IEnumerable<ChartEntry>)GetValue(EntriesProperty);
|
||||
set => SetValue(EntriesProperty, value);
|
||||
}
|
||||
|
||||
public ColorWpf BackgroundColor
|
||||
{
|
||||
get => (ColorWpf)GetValue(BackgroundColorProperty);
|
||||
set => SetValue(BackgroundColorProperty, value);
|
||||
}
|
||||
Color IChart.BackgroundColor
|
||||
{
|
||||
get => BackgroundColor.Color;
|
||||
set => BackgroundColor = new ColorWpf(value);
|
||||
}
|
||||
|
||||
public ColorWpf LabelColor
|
||||
{
|
||||
get => (ColorWpf)GetValue(LabelColorProperty);
|
||||
set => SetValue(LabelColorProperty, value);
|
||||
}
|
||||
Color IChart.LabelColor
|
||||
{
|
||||
get => LabelColor.Color;
|
||||
set => LabelColor = new ColorWpf(value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,49 +1,14 @@
|
|||
// This code will eventually be generated.
|
||||
|
||||
using Microsoft.StandardUI.Wpf;
|
||||
using Microcharts;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.StandardUI;
|
||||
|
||||
namespace SimpleControls.Wpf
|
||||
{
|
||||
public class PointChart : StandardControl, IPointChart
|
||||
public class PointChart : Chart, IPointChart
|
||||
{
|
||||
public static readonly System.Windows.DependencyProperty EntriesProperty = PropertyUtils.Register(nameof(Entries), typeof(IEnumerable<ChartEntry>), typeof(PointChart), null);
|
||||
public static readonly System.Windows.DependencyProperty BackgroundColorProperty = PropertyUtils.Register(nameof(BackgroundColor), typeof(ColorWpf), typeof(PointChart), ColorWpf.Default);
|
||||
public static readonly System.Windows.DependencyProperty LabelColorProperty = PropertyUtils.Register(nameof(LabelColor), typeof(ColorWpf), typeof(PointChart), ColorWpf.Default);
|
||||
|
||||
public PointChart()
|
||||
{
|
||||
InitImplementation(new PointChartImplementation<IPointChart>(this));
|
||||
}
|
||||
|
||||
public IEnumerable<ChartEntry> Entries
|
||||
{
|
||||
get => (IEnumerable<ChartEntry>)GetValue(EntriesProperty);
|
||||
set => SetValue(EntriesProperty, value);
|
||||
}
|
||||
|
||||
public ColorWpf BackgroundColor
|
||||
{
|
||||
get => (ColorWpf)GetValue(BackgroundColorProperty);
|
||||
set => SetValue(BackgroundColorProperty, value);
|
||||
}
|
||||
Color IChart.BackgroundColor
|
||||
{
|
||||
get => BackgroundColor.Color;
|
||||
set => BackgroundColor = new ColorWpf(value);
|
||||
}
|
||||
|
||||
public ColorWpf LabelColor
|
||||
{
|
||||
get => (ColorWpf)GetValue(LabelColorProperty);
|
||||
set => SetValue(LabelColorProperty, value);
|
||||
}
|
||||
Color IChart.LabelColor
|
||||
{
|
||||
get => LabelColor.Color;
|
||||
set => LabelColor = new ColorWpf(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче