refactor<Statistics>: use committer instead of author

This commit is contained in:
leo 2024-02-25 11:32:15 +08:00
parent e070b79d2c
commit 68ddeb4cc5
7 changed files with 174 additions and 208 deletions

View file

@ -7,7 +7,7 @@ namespace SourceGit.Commands {
WorkingDirectory = repo; WorkingDirectory = repo;
Context = repo; Context = repo;
Args = $"log --date-order --branches --remotes --since=\"{_statistics.Since()}\" --date=unix --pretty=format:\"%ad$%an\""; Args = $"log --date-order --branches --remotes --since=\"{_statistics.Since()}\" --pretty=format:\"%ct$%cn\"";
} }
public Models.Statistics Result() { public Models.Statistics Result() {

View file

@ -2,23 +2,41 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace SourceGit.Models { namespace SourceGit.Models {
public class Sample { public class StatisticsSample {
public string Name { get; set; } public string Name { get; set; }
public int Count { get; set; } public int Count { get; set; }
} }
public class StatisticsReport {
public int Total { get; set; } = 0;
public List<StatisticsSample> Samples { get; set; } = new List<StatisticsSample>();
public List<StatisticsSample> ByCommitter { get; set; } = new List<StatisticsSample>();
public void AddCommit(int index, string committer) {
Total++;
Samples[index].Count++;
if (_mapByCommitter.ContainsKey(committer)) {
_mapByCommitter[committer].Count++;
} else {
var sample = new StatisticsSample() { Name = committer, Count = 1 };
_mapByCommitter.Add(committer, sample);
ByCommitter.Add(sample);
}
}
public void Complete() {
ByCommitter.Sort((l, r) => r.Count - l.Count);
_mapByCommitter.Clear();
}
private Dictionary<string, StatisticsSample> _mapByCommitter = new Dictionary<string, StatisticsSample>();
}
public class Statistics { public class Statistics {
public int TotalYear { get; set; } = 0; public StatisticsReport Year { get; set; } = new StatisticsReport();
public int TotalMonth { get; set; } = 0; public StatisticsReport Month { get; set; } = new StatisticsReport();
public int TotalWeek { get; set; } = 0; public StatisticsReport Week { get; set; } = new StatisticsReport();
public List<Sample> Year { get; set; } = new List<Sample>();
public List<Sample> Month { get; set; } = new List<Sample>();
public List<Sample> Week { get; set; } = new List<Sample>();
public List<Sample> YearByAuthor { get; set; } = new List<Sample>();
public List<Sample> MonthByAuthor { get; set; } = new List<Sample>();
public List<Sample> WeekByAuthor { get; set; } = new List<Sample>();
public Statistics() { public Statistics() {
_utcStart = DateTime.UnixEpoch; _utcStart = DateTime.UnixEpoch;
@ -42,7 +60,7 @@ namespace SourceGit.Models {
]; ];
for (int i = 0; i < monthNames.Length; i++) { for (int i = 0; i < monthNames.Length; i++) {
Year.Add(new Sample { Year.Samples.Add(new StatisticsSample {
Name = monthNames[i], Name = monthNames[i],
Count = 0, Count = 0,
}); });
@ -50,7 +68,7 @@ namespace SourceGit.Models {
var monthDays = DateTime.DaysInMonth(_today.Year, _today.Month); var monthDays = DateTime.DaysInMonth(_today.Year, _today.Month);
for (int i = 0; i < monthDays; i++) { for (int i = 0; i < monthDays; i++) {
Month.Add(new Sample { Month.Samples.Add(new StatisticsSample {
Name = $"{i + 1}", Name = $"{i + 1}",
Count = 0, Count = 0,
}); });
@ -67,7 +85,7 @@ namespace SourceGit.Models {
]; ];
for (int i = 0; i < weekDayNames.Length; i++) { for (int i = 0; i < weekDayNames.Length; i++) {
Week.Add(new Sample { Week.Samples.Add(new StatisticsSample {
Name = weekDayNames[i], Name = weekDayNames[i],
Count = 0, Count = 0,
}); });
@ -78,52 +96,28 @@ namespace SourceGit.Models {
return _today.ToString("yyyy-01-01 00:00:00"); return _today.ToString("yyyy-01-01 00:00:00");
} }
public void AddCommit(string author, double timestamp) { public void AddCommit(string committer, double timestamp) {
var authorTime = _utcStart.AddSeconds(timestamp); var time = _utcStart.AddSeconds(timestamp);
if (authorTime.CompareTo(_thisWeekStart) >= 0 && authorTime.CompareTo(_thisWeekEnd) < 0) { if (time.CompareTo(_thisWeekStart) >= 0 && time.CompareTo(_thisWeekEnd) < 0) {
Week[(int)authorTime.DayOfWeek].Count++; Week.AddCommit((int)time.DayOfWeek, committer);
TotalWeek++;
AddByAuthor(_mapWeekByAuthor, WeekByAuthor, author);
} }
if (authorTime.Month == _today.Month) { if (time.Month == _today.Month) {
Month[authorTime.Day - 1].Count++; Month.AddCommit(time.Day - 1, committer);
TotalMonth++;
AddByAuthor(_mapMonthByAuthor, MonthByAuthor, author);
} }
Year[authorTime.Month - 1].Count++; Year.AddCommit(time.Month, committer);
TotalYear++;
AddByAuthor(_mapYearByAuthor, YearByAuthor, author);
} }
public void Complete() { public void Complete() {
_mapYearByAuthor.Clear(); Year.Complete();
_mapMonthByAuthor.Clear(); Month.Complete();
_mapWeekByAuthor.Clear(); Week.Complete();
YearByAuthor.Sort((l, r) => r.Count - l.Count);
MonthByAuthor.Sort((l, r) => r.Count - l.Count);
WeekByAuthor.Sort((l, r) => r.Count - l.Count);
}
private void AddByAuthor(Dictionary<string, Sample> map, List<Sample> collection, string author) {
if (map.ContainsKey(author)) {
map[author].Count++;
} else {
var sample = new Sample { Name = author, Count = 1 };
map.Add(author, sample);
collection.Add(sample);
}
} }
private DateTime _utcStart; private DateTime _utcStart;
private DateTime _today; private DateTime _today;
private DateTime _thisWeekStart; private DateTime _thisWeekStart;
private DateTime _thisWeekEnd; private DateTime _thisWeekEnd;
private Dictionary<string, Sample> _mapYearByAuthor = new Dictionary<string, Sample>();
private Dictionary<string, Sample> _mapMonthByAuthor = new Dictionary<string, Sample>();
private Dictionary<string, Sample> _mapWeekByAuthor = new Dictionary<string, Sample>();
} }
} }

View file

@ -461,9 +461,9 @@
<sys:String x:Key="Text.Statistics.ThisWeek">WEEK</sys:String> <sys:String x:Key="Text.Statistics.ThisWeek">WEEK</sys:String>
<sys:String x:Key="Text.Statistics.ThisMonth">MONTH</sys:String> <sys:String x:Key="Text.Statistics.ThisMonth">MONTH</sys:String>
<sys:String x:Key="Text.Statistics.ThisYear">YEAR</sys:String> <sys:String x:Key="Text.Statistics.ThisYear">YEAR</sys:String>
<sys:String x:Key="Text.Statistics.TotalAuthors">Total Authors</sys:String> <sys:String x:Key="Text.Statistics.TotalCommitters">Total Committers</sys:String>
<sys:String x:Key="Text.Statistics.TotalCommits">Total Commits</sys:String> <sys:String x:Key="Text.Statistics.TotalCommits">Total Commits</sys:String>
<sys:String x:Key="Text.Statistics.AuthorName">AUTHOR</sys:String> <sys:String x:Key="Text.Statistics.Committer">COMMITTER</sys:String>
<sys:String x:Key="Text.Statistics.CommitAmount">COMMITS</sys:String> <sys:String x:Key="Text.Statistics.CommitAmount">COMMITS</sys:String>
<sys:String x:Key="Text.NotConfigured">Git has NOT been configured. Please to go [Preference] and configure it first.</sys:String> <sys:String x:Key="Text.NotConfigured">Git has NOT been configured. Please to go [Preference] and configure it first.</sys:String>

View file

@ -460,9 +460,9 @@
<sys:String x:Key="Text.Statistics.ThisWeek">本周</sys:String> <sys:String x:Key="Text.Statistics.ThisWeek">本周</sys:String>
<sys:String x:Key="Text.Statistics.ThisMonth">本月</sys:String> <sys:String x:Key="Text.Statistics.ThisMonth">本月</sys:String>
<sys:String x:Key="Text.Statistics.ThisYear">本年</sys:String> <sys:String x:Key="Text.Statistics.ThisYear">本年</sys:String>
<sys:String x:Key="Text.Statistics.TotalAuthors">作者人数</sys:String> <sys:String x:Key="Text.Statistics.TotalCommitters">提交者人数</sys:String>
<sys:String x:Key="Text.Statistics.TotalCommits">总计提交次数</sys:String> <sys:String x:Key="Text.Statistics.TotalCommits">总计提交次数</sys:String>
<sys:String x:Key="Text.Statistics.AuthorName">作者</sys:String> <sys:String x:Key="Text.Statistics.Committer">提交者</sys:String>
<sys:String x:Key="Text.Statistics.CommitAmount">提交次数</sys:String> <sys:String x:Key="Text.Statistics.CommitAmount">提交次数</sys:String>
<sys:String x:Key="Text.NotConfigured">GIT尚未配置。请打开【偏好设置】配置GIT路径。</sys:String> <sys:String x:Key="Text.NotConfigured">GIT尚未配置。请打开【偏好设置】配置GIT路径。</sys:String>

View file

@ -8,10 +8,17 @@ namespace SourceGit.ViewModels {
get => _isLoading; get => _isLoading;
private set => SetProperty(ref _isLoading, value); private set => SetProperty(ref _isLoading, value);
} }
public int SelectedIndex {
get => _selectedIndex;
set {
if (SetProperty(ref _selectedIndex, value)) RefreshReport();
}
}
public Models.Statistics Data { public Models.StatisticsReport SelectedReport {
get => _data; get => _selectedReport;
private set => SetProperty(ref _data, value); private set => SetProperty(ref _selectedReport, value);
} }
public Statistics(string repo) { public Statistics(string repo) {
@ -20,14 +27,27 @@ namespace SourceGit.ViewModels {
Task.Run(() => { Task.Run(() => {
var result = new Commands.Statistics(_repo).Result(); var result = new Commands.Statistics(_repo).Result();
Dispatcher.UIThread.Invoke(() => { Dispatcher.UIThread.Invoke(() => {
_data = result;
RefreshReport();
IsLoading = false; IsLoading = false;
Data = result;
}); });
}); });
} }
private void RefreshReport() {
if (_data == null) return;
switch (_selectedIndex) {
case 0: SelectedReport = _data.Year; break;
case 1: SelectedReport = _data.Month; break;
default: SelectedReport = _data.Week; break;
}
}
private string _repo = string.Empty; private string _repo = string.Empty;
private bool _isLoading = true; private bool _isLoading = true;
private Models.Statistics _data = null; private Models.Statistics _data = null;
private Models.StatisticsReport _selectedReport = null;
private int _selectedIndex = 0;
} }
} }

View file

@ -15,7 +15,7 @@
CanResize="False" CanResize="False"
ExtendClientAreaToDecorationsHint="True" ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"> ExtendClientAreaChromeHints="NoChrome">
<Grid RowDefinitions="30,*"> <Grid RowDefinitions="30,Auto,*">
<!-- Title bar --> <!-- Title bar -->
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto"> <Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto">
<Border Grid.Column="0" Grid.ColumnSpan="3" <Border Grid.Column="0" Grid.ColumnSpan="3"
@ -52,164 +52,116 @@
</Button> </Button>
</Grid> </Grid>
<!-- Body --> <!-- View mode switcher -->
<TabControl Grid.Row="1" Margin="0,8,0,0"> <ListBox Grid.Row="1"
<TabControl.Styles> Margin="0,8,0,0"
<Style Selector="TabControl /template/ ItemsPresenter#PART_ItemsPresenter"> SelectedIndex="{Binding SelectedIndex, Mode=TwoWay}"
<Setter Property="HorizontalAlignment" Value="Center"/> HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.Styles>
<Style Selector="ListBoxItem">
<Setter Property="Padding" Value="0"/>
<Setter Property="Background" Value="Transparent"/>
</Style> </Style>
</TabControl.Styles>
<TabItem>
<TabItem.Header>
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Statistics.ThisYear}"/>
</TabItem.Header>
<Grid RowDefinitions="*,32" ColumnDefinitions="Auto,*" Margin="8"> <Style Selector="ListBoxItem:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<!-- Table By Author --> <Setter Property="Background" Value="Transparent"/>
<DataGrid Grid.Row="0" Grid.Column="0" </Style>
ItemsSource="{Binding Data.YearByAuthor}"
SelectionMode="Single"
CanUserReorderColumns="False"
CanUserResizeColumns="False"
CanUserSortColumns="False"
HeadersVisibility="Column"
GridLinesVisibility="All"
BorderThickness="1"
BorderBrush="{DynamicResource Brush.Border1}"
Background="{DynamicResource Brush.Contents}"
IsReadOnly="True"
RowHeight="26"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<DataGrid.Columns>
<DataGridTextColumn Width="150" Header="{DynamicResource Text.Statistics.AuthorName}" Binding="{Binding Name}"/>
<DataGridTextColumn Width="100" Header="{DynamicResource Text.Statistics.CommitAmount}" Binding="{Binding Count}"/>
</DataGrid.Columns>
</DataGrid>
<!-- Total Authors --> <Style Selector="ListBoxItem:selected /template/ ContentPresenter#PART_ContentPresenter">
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal"> <Setter Property="Background" Value="Transparent"/>
<TextBlock Text="{DynamicResource Text.Statistics.TotalAuthors}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/> </Style>
<TextBlock Text="{Binding Data.YearByAuthor.Count}" Margin="4,0,0,0"/>
</StackPanel>
<!-- Graph --> <Style Selector="ListBoxItem:selected Border.switcher_bg">
<v:Chart Grid.Row="0" Grid.Column="1" <Setter Property="Background" Value="{DynamicResource Brush.Contents}"/>
Margin="16,8,0,0" </Style>
FontFamily="{StaticResource JetBrainsMono}"
LineBrush="{DynamicResource Brush.FG1}" <Style Selector="TextBlock.view_mode_switcher">
ShapeBrush="{DynamicResource Brush.Accent1}" <Setter Property="FontWeight" Value="Bold"/>
Samples="{Binding Data.Year}"/> <Setter Property="Foreground" Value="{DynamicResource Brush.FG2}"/>
</Style>
<!-- Total Commits --> <Style Selector="ListBoxItem:selected TextBlock.view_mode_switcher">
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right"> <Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
<TextBlock Text="{DynamicResource Text.Statistics.TotalCommits}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/> </Style>
<TextBlock Text="{Binding Data.TotalYear}" Margin="4,0,0,0"/> </ListBox.Styles>
</StackPanel>
</Grid>
</TabItem>
<TabItem> <ListBoxItem>
<TabItem.Header> <Border Classes="switcher_bg" Height="28" Padding="16,0" BorderThickness="1,1,0,1" BorderBrush="{DynamicResource Brush.Border1}" CornerRadius="14,0,0,14">
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Statistics.ThisMonth}"/> <TextBlock Classes="view_mode_switcher" Text="{DynamicResource Text.Statistics.ThisYear}"/>
</TabItem.Header> </Border>
</ListBoxItem>
<Grid RowDefinitions="*,32" ColumnDefinitions="Auto,*" Margin="8"> <ListBoxItem>
<!-- Table By Author --> <Border Classes="switcher_bg" Height="28" Padding="16,0" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border1}">
<DataGrid Grid.Row="0" Grid.Column="0" <TextBlock Classes="view_mode_switcher" Text="{DynamicResource Text.Statistics.ThisMonth}"/>
ItemsSource="{Binding Data.MonthByAuthor}" </Border>
SelectionMode="Single" </ListBoxItem>
CanUserReorderColumns="False"
CanUserResizeColumns="False"
CanUserSortColumns="False"
HeadersVisibility="Column"
GridLinesVisibility="All"
BorderThickness="1"
BorderBrush="{DynamicResource Brush.Border1}"
Background="{DynamicResource Brush.Contents}"
IsReadOnly="True"
RowHeight="26"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<DataGrid.Columns>
<DataGridTextColumn Width="150" Header="{DynamicResource Text.Statistics.AuthorName}" Binding="{Binding Name}"/>
<DataGridTextColumn Width="100" Header="{DynamicResource Text.Statistics.CommitAmount}" Binding="{Binding Count}"/>
</DataGrid.Columns>
</DataGrid>
<!-- Total Authors --> <ListBoxItem>
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal"> <Border Classes="switcher_bg" Height="28" Padding="16,0" BorderThickness="0,1,1,1" BorderBrush="{DynamicResource Brush.Border1}" CornerRadius="0,14,14,0">
<TextBlock Text="{DynamicResource Text.Statistics.TotalAuthors}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/> <TextBlock Classes="view_mode_switcher" Text="{DynamicResource Text.Statistics.ThisWeek}"/>
<TextBlock Text="{Binding Data.MonthByAuthor.Count}" Margin="4,0,0,0"/> </Border>
</StackPanel> </ListBoxItem>
</ListBox>
<!-- Graph --> <!-- Contents -->
<v:Chart Grid.Row="0" Grid.Column="1" <ContentControl Grid.Row="2" Content="{Binding SelectedReport, Mode=OneWay}">
Margin="16,8,0,0" <ContentControl.DataTemplates>
FontFamily="{StaticResource JetBrainsMono}" <DataTemplate DataType="m:StatisticsReport">
LineBrush="{DynamicResource Brush.FG1}" <Grid RowDefinitions="*,32" ColumnDefinitions="Auto,*" Margin="8">
ShapeBrush="{DynamicResource Brush.Accent1}" <!-- Table By Committer -->
Samples="{Binding Data.Month}"/> <DataGrid Grid.Row="0" Grid.Column="0"
ItemsSource="{Binding ByCommitter}"
SelectionMode="Single"
CanUserReorderColumns="False"
CanUserResizeColumns="False"
CanUserSortColumns="False"
HeadersVisibility="Column"
GridLinesVisibility="All"
BorderThickness="1"
BorderBrush="{DynamicResource Brush.Border1}"
Background="{DynamicResource Brush.Contents}"
IsReadOnly="True"
RowHeight="26"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<DataGrid.Columns>
<DataGridTextColumn Width="150" Header="{DynamicResource Text.Statistics.Committer}" Binding="{Binding Name}"/>
<DataGridTextColumn Width="100" Header="{DynamicResource Text.Statistics.CommitAmount}" Binding="{Binding Count}"/>
</DataGrid.Columns>
</DataGrid>
<!-- Total Commits --> <!-- Total Committers -->
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right"> <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="{DynamicResource Text.Statistics.TotalCommits}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/> <TextBlock Text="{DynamicResource Text.Statistics.TotalCommitters}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/>
<TextBlock Text="{Binding Data.TotalMonth}" Margin="4,0,0,0"/> <TextBlock Text="{Binding ByCommitter.Count}" Margin="4,0,0,0"/>
</StackPanel> </StackPanel>
</Grid>
</TabItem>
<TabItem> <!-- Graph -->
<TabItem.Header> <v:Chart Grid.Row="0" Grid.Column="1"
<TextBlock Classes="tab_header" Text="{DynamicResource Text.Statistics.ThisWeek}"/> Margin="16,8,0,0"
</TabItem.Header> FontFamily="{StaticResource JetBrainsMono}"
LineBrush="{DynamicResource Brush.FG1}"
ShapeBrush="{DynamicResource Brush.Accent1}"
Samples="{Binding Samples}"/>
<Grid RowDefinitions="*,32" ColumnDefinitions="Auto,*" Margin="8"> <!-- Total Commits -->
<!-- Table By Author --> <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<DataGrid Grid.Row="0" Grid.Column="0" <TextBlock Text="{DynamicResource Text.Statistics.TotalCommits}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/>
ItemsSource="{Binding Data.WeekByAuthor}" <TextBlock Text="{Binding Total}" Margin="4,0,0,0"/>
SelectionMode="Single" </StackPanel>
CanUserReorderColumns="False" </Grid>
CanUserResizeColumns="False" </DataTemplate>
CanUserSortColumns="False" </ContentControl.DataTemplates>
HeadersVisibility="Column" </ContentControl>
GridLinesVisibility="All"
BorderThickness="1"
BorderBrush="{DynamicResource Brush.Border1}"
Background="{DynamicResource Brush.Contents}"
IsReadOnly="True"
RowHeight="26"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<DataGrid.Columns>
<DataGridTextColumn Width="150" Header="{DynamicResource Text.Statistics.AuthorName}" Binding="{Binding Name}"/>
<DataGridTextColumn Width="100" Header="{DynamicResource Text.Statistics.CommitAmount}" Binding="{Binding Count}"/>
</DataGrid.Columns>
</DataGrid>
<!-- Total Authors -->
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="{DynamicResource Text.Statistics.TotalAuthors}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/>
<TextBlock Text="{Binding Data.WeekByAuthor.Count}" Margin="4,0,0,0"/>
</StackPanel>
<!-- Graph -->
<v:Chart Grid.Row="0" Grid.Column="1"
Margin="16,8,0,0"
FontFamily="{StaticResource JetBrainsMono}"
LineBrush="{DynamicResource Brush.FG1}"
ShapeBrush="{DynamicResource Brush.Accent1}"
Samples="{Binding Data.Week}"/>
<!-- Total Commits -->
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock Text="{DynamicResource Text.Statistics.TotalCommits}" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold"/>
<TextBlock Text="{Binding Data.TotalWeek}" Margin="4,0,0,0"/>
</StackPanel>
</Grid>
</TabItem>
</TabControl>
<!-- Loading Mask --> <!-- Loading Mask -->
<Path Grid.Row="1" <Path Grid.Row="1"

View file

@ -33,10 +33,10 @@ namespace SourceGit.Views {
set => SetValue(ShapeBrushProperty, value); set => SetValue(ShapeBrushProperty, value);
} }
public static readonly StyledProperty<List<Models.Sample>> SamplesProperty = public static readonly StyledProperty<List<Models.StatisticsSample>> SamplesProperty =
AvaloniaProperty.Register<Chart, List<Models.Sample>>(nameof(Samples), null); AvaloniaProperty.Register<Chart, List<Models.StatisticsSample>>(nameof(Samples), null);
public List<Models.Sample> Samples { public List<Models.StatisticsSample> Samples {
get => GetValue(SamplesProperty); get => GetValue(SamplesProperty);
set => SetValue(SamplesProperty, value); set => SetValue(SamplesProperty, value);
} }