Change hand-generated Chart classes to derive from each other
This commit is contained in:
Родитель
9d3eb3b1d2
Коммит
9faea9a8bb
|
@ -20,12 +20,12 @@ namespace Microcharts
|
|||
///
|
||||
/// A bar chart.
|
||||
/// </summary>
|
||||
public class BarChartImplementation<T> : PointChartImplementation<T> where T : IBarChart
|
||||
public class BarChartImplementation : PointChartImplementation<IBarChart>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:Microcharts.BarChart"/> class.
|
||||
/// </summary>
|
||||
public BarChartImplementation(T control) : base(control)
|
||||
public BarChartImplementation(IBarChart control) : base(control)
|
||||
{
|
||||
PointSize = 0;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
@ -19,6 +17,13 @@ namespace Microcharts
|
|||
{
|
||||
}
|
||||
|
||||
public class PointChartImplementation : PointChartImplementation<IPointChart>
|
||||
{
|
||||
public PointChartImplementation(IPointChart control) : base(control)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ![chart](../images/Point.png)
|
||||
///
|
||||
|
|
|
@ -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);
|
||||
InitImplementation(new BarChartImplementation(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
InitImplementation(new PointChartImplementation(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче