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:
Erik De Bonte 2021-10-14 15:29:32 -07:00 коммит произвёл GitHub
Родитель 9d3eb3b1d2 c46fda1fe0
Коммит 8f74cca727
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 47 добавлений и 75 удалений

Просмотреть файл

@ -7,11 +7,9 @@ using System.Globalization;
using System.Linq; using System.Linq;
using Microsoft.StandardUI; using Microsoft.StandardUI;
using Microsoft.StandardUI.Controls; using Microsoft.StandardUI.Controls;
using Microsoft.StandardUI.Media;
using Microsoft.StandardUI.Shapes; using Microsoft.StandardUI.Shapes;
using static Microsoft.StandardUI.FactoryStatics; using static Microsoft.StandardUI.FactoryStatics;
using SkiaSharp;
using SkiaSharp.HarfBuzz;
using Microsoft.StandardUI.Media;
namespace Microcharts namespace Microcharts
{ {

Просмотреть файл

@ -1,49 +1,14 @@
// This code will eventually be generated. // This code will eventually be generated.
using Microsoft.StandardUI.Wpf;
using Microcharts; using Microcharts;
using System.Collections.Generic;
using Microsoft.StandardUI;
namespace SimpleControls.Wpf 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() public BarChart()
{ {
InitImplementation(new BarChartImplementation<IBarChart>(this)); 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. // This code will eventually be generated.
using Microsoft.StandardUI.Wpf;
using Microcharts; using Microcharts;
using System.Collections.Generic;
using Microsoft.StandardUI;
namespace SimpleControls.Wpf 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() public PointChart()
{ {
InitImplementation(new PointChartImplementation<IPointChart>(this)); 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);
}
} }
} }