Vereinsmeisterschaften  22aa7800eae54b428d40e835886cefe1fdefdfdf
This is a software that can be used to manage the internal competition of the swimming club Illertissen called "Vereinsmeisterschaften".
Loading...
Searching...
No Matches
AnalyticsWidgetAgeDistribution.xaml.cs
1using LiveChartsCore;
2using LiveChartsCore.Kernel;
3using LiveChartsCore.SkiaSharpView;
4using LiveChartsCore.SkiaSharpView.Painting;
6
8{
12 public partial class AnalyticsWidgetAgeDistribution : AnalyticsWidgetBase
13 {
15
16 public AnalyticsWidgetAgeDistribution(AnalyticsModuleAgeDistribution analyticsModule) : base(analyticsModule)
17 {
18 InitializeComponent();
19 }
20
21 public override string Icon => "\uED55";
22
23 public override void Refresh()
24 {
25 OnPropertyChanged(nameof(NumberPersonsPerBirthYearSeries));
26 OnPropertyChanged(nameof(XAxes));
27 OnPropertyChanged(nameof(YAxes));
28 base.Refresh();
29 }
30
31 public Dictionary<UInt16, int> NumberPersonsPerBirthYear => _analyticsModule?.NumberPersonsPerBirthYear ?? new Dictionary<UInt16, int>();
32
33 public ISeries[] NumberPersonsPerBirthYearSeries => _analyticsModule == null ? null : new ISeries[]
34 {
35 new LineSeries<KeyValuePair<UInt16, int>>
36 {
37 Values = NumberPersonsPerBirthYear,
38 Mapping = (model, index) =>
39 {
40 return new Coordinate(model.Key, model.Value);
41 },
42 YToolTipLabelFormatter = point => $"{point.Model.Key}: {point.Model.Value}",
43 Stroke = new SolidColorPaint(ColorPaintMahAppsAccent.Color, 4),
44 GeometryStroke = new SolidColorPaint(ColorPaintMahAppsAccent.Color, 4),
45 Fill = new SolidColorPaint(ColorPaintMahAppsAccent.Color.WithAlpha(0x33)) // modify alpha channel for transparency
46 }
47 };
48
49 public Axis[] XAxes =>
50 [
51 new Axis
52 {
53 IsVisible = true,
55 NamePaint = ColorPaintMahAppsText,
56 NameTextSize = ANALYTICS_WIDGET_AXIS_TEXTSIZE_DEFAULT,
57 LabelsPaint = ColorPaintMahAppsText,
58 TextSize = ANALYTICS_WIDGET_AXIS_TEXTSIZE_DEFAULT,
59 MinStep = 1
60 }
61 ];
62
63 public Axis[] YAxes =>
64 [
65 new Axis
66 {
67 IsVisible = true,
68 Name = Properties.Resources.CountString,
69 NamePaint = ColorPaintMahAppsText,
70 NameTextSize = ANALYTICS_WIDGET_AXIS_TEXTSIZE_DEFAULT,
71 SeparatorsPaint = COLORPAINT_SEPARATORS,
72 LabelsPaint = ColorPaintMahAppsText,
73 TextSize = ANALYTICS_WIDGET_AXIS_TEXTSIZE_DEFAULT,
74 LabelsDensity = 0,
75 Labeler = (value) =>
76 {
77 // Only return labels for real values (no doubles with fractional part)
78 if(value == Math.Floor(value))
79 {
80 return value.ToString();
81 }
82 return "";
83 }
84 }
85 ];
86 }
87}
Analytics module to calculate the age distribution of all persons.
Dictionary< UInt16, int > NumberPersonsPerBirthYear
Dictionary that counts the number of persons (value) per birth year (key)
Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
static string BirthYearString
Sucht eine lokalisierte Zeichenfolge, die Birth Year ähnelt.
SolidColorPaint ColorPaintMahAppsAccent
SolidColorPaint that represents the MahApps.Brushes.Accent brush.
IAnalyticsModule AnalyticsModule
Analytics module used by this user control.
SolidColorPaint ColorPaintMahAppsText
SolidColorPaint that represents the MahApps.Brushes.Text brush.
AnalyticsWidgetBase(IAnalyticsModule analyticsModule)
Constructor of the AnalyticsWidgetBase