Skip to content

Commit 3c4dd30

Browse files
committed
feature: add a pie-chart for top contributors
Signed-off-by: leo <longshuang@msn.cn>
1 parent 873b7fc commit 3c4dd30

5 files changed

Lines changed: 495 additions & 45 deletions

File tree

‎src/Resources/Locales/en_US.axaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,10 +950,14 @@
950950
<x:String x:Key="Text.Stashes.Changes" xml:space="preserve">CHANGES</x:String>
951951
<x:String x:Key="Text.Stashes.Stashes" xml:space="preserve">STASHES</x:String>
952952
<x:String x:Key="Text.Statistics" xml:space="preserve">Statistics</x:String>
953+
<x:String x:Key="Text.Statistics.Commits" xml:space="preserve">COMMITS</x:String>
953954
<x:String x:Key="Text.Statistics.Overview" xml:space="preserve">OVERVIEW</x:String>
954955
<x:String x:Key="Text.Statistics.ThisMonth" xml:space="preserve">MONTH</x:String>
955956
<x:String x:Key="Text.Statistics.ThisWeek" xml:space="preserve">WEEK</x:String>
956957
<x:String x:Key="Text.Statistics.Tips" xml:space="preserve">SourceGit will only get a maximum of 200,000 commits according to the target branch for analysis.</x:String>
958+
<x:String x:Key="Text.Statistics.TopAuthors" xml:space="preserve">TOP AUTHORS</x:String>
959+
<x:String x:Key="Text.Statistics.TopAuthors.Count" xml:space="preserve">COMMITS</x:String>
960+
<x:String x:Key="Text.Statistics.TopAuthors.Percentage" xml:space="preserve">PERCENTAGE</x:String>
957961
<x:String x:Key="Text.Statistics.TotalAuthors" xml:space="preserve">AUTHORS: </x:String>
958962
<x:String x:Key="Text.Statistics.TotalCommits" xml:space="preserve">COMMITS: </x:String>
959963
<x:String x:Key="Text.Submodule" xml:space="preserve">SUBMODULES</x:String>

‎src/Resources/Locales/zh_CN.axaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -954,10 +954,14 @@
954954
<x:String x:Key="Text.Stashes.Changes" xml:space="preserve">查看变更</x:String>
955955
<x:String x:Key="Text.Stashes.Stashes" xml:space="preserve">贮藏列表</x:String>
956956
<x:String x:Key="Text.Statistics" xml:space="preserve">提交统计</x:String>
957+
<x:String x:Key="Text.Statistics.Commits" xml:space="preserve">提交统计图</x:String>
957958
<x:String x:Key="Text.Statistics.Overview" xml:space="preserve">总览</x:String>
958959
<x:String x:Key="Text.Statistics.ThisMonth" xml:space="preserve">本月</x:String>
959960
<x:String x:Key="Text.Statistics.ThisWeek" xml:space="preserve">本周</x:String>
960961
<x:String x:Key="Text.Statistics.Tips" xml:space="preserve">SourceGit 仅会按所选分支最多取出 200000 条提交记录进行分析</x:String>
962+
<x:String x:Key="Text.Statistics.TopAuthors" xml:space="preserve">主要贡献者</x:String>
963+
<x:String x:Key="Text.Statistics.TopAuthors.Count" xml:space="preserve">提交数量</x:String>
964+
<x:String x:Key="Text.Statistics.TopAuthors.Percentage" xml:space="preserve">百分比</x:String>
961965
<x:String x:Key="Text.Statistics.TotalAuthors" xml:space="preserve">贡献者人数: </x:String>
962966
<x:String x:Key="Text.Statistics.TotalCommits" xml:space="preserve">提交次数: </x:String>
963967
<x:String x:Key="Text.Submodule" xml:space="preserve">子模块</x:String>

‎src/ViewModels/Statistics.cs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ public Models.StatisticsReport SelectedReport
4545
private set => SetProperty(ref _selectedReport, value);
4646
}
4747

48+
public Models.StatisticsAuthor SelectedAuthor
49+
{
50+
get => _selectedAuthor;
51+
}
52+
4853
public Models.StatisticsSamples Samples
4954
{
5055
get => _samples;
@@ -60,9 +65,10 @@ public Statistics(string repo)
6065

6166
public void ChangeAuthor(Models.StatisticsAuthor author)
6267
{
63-
if (SelectedReport == null)
68+
if (SelectedReport == null || author == _selectedAuthor)
6469
return;
6570

71+
_selectedAuthor = author;
6672
Samples = SelectedReport.GetSamples(author);
6773
}
6874

@@ -120,6 +126,7 @@ private void RefreshReport()
120126
private Models.Statistics _data = null;
121127
private Models.StatisticsMode _viewMode = Models.StatisticsMode.All;
122128
private Models.StatisticsReport _selectedReport = null;
129+
private Models.StatisticsAuthor _selectedAuthor = null;
123130
private Models.StatisticsSamples _samples = null;
124131
}
125132
}

0 commit comments

Comments
 (0)