23 InitializeComponent();
24 PART_scrollViewerChart.SizeChanged += (sender, e) => OnPropertyChanged(nameof(
ChartHeight));
27 public override string Icon {
get; } =
"\uE77B";
31 OnPropertyChanged(nameof(StartsPerPersonSeries));
33 OnPropertyChanged(nameof(XAxes));
34 OnPropertyChanged(nameof(YAxes));
38 public Dictionary<Person, int> NumberStartsPerPersonReordered => _analyticsModule?.
NumberStartsPerPerson?.OrderBy(s => s.Value)?.ToDictionary() ??
new Dictionary<Person, int>();
40 public ISeries[] StartsPerPersonSeries
44 if (_analyticsModule ==
null)
return null;
46 List<ISeries> seriesList =
new List<ISeries>();
47 var series =
new RowSeries<KeyValuePair<Person, int>>
49 Values = NumberStartsPerPersonReordered,
50 Mapping = (model, index) =>
52 return new Coordinate(index, model.Value);
54 DataLabelsPaint =
new SolidColorPaint(SKColors.Black),
56 DataLabelsPosition = DataLabelsPosition.End,
57 DataLabelsTranslate =
new(-1, 0),
60 .OnPointMeasured(point =>
63 if (point.Visual is
null)
return;
64 int colorIndex = point.Index;
65 point.Visual.Fill =
new SolidColorPaint(ColorPalletes.MaterialDesign500[colorIndex % ColorPalletes.MaterialDesign500.Length].AsSKColor());
67 seriesList.Add(series);
69 return seriesList.ToArray();
84 public Axis[] XAxes =>
90 NameTextSize = ANALYTICS_WIDGET_AXIS_TEXTSIZE_DEFAULT,
92 SeparatorsPaint = COLORPAINT_SEPARATORS,
94 TextSize = ANALYTICS_WIDGET_AXIS_TEXTSIZE_DEFAULT,
100 public Axis[] YAxes =>
105 SeparatorsPaint =
null,
106 Labels = NumberStartsPerPersonReordered.Keys.Select(p => $
"{p.FirstName}, {p.Name}").ToArray(),
108 TextSize = ANALYTICS_WIDGET_AXIS_TEXTSIZE_DEFAULT,
110 ForceStepToMin =
true