Skip to content

Commit

Permalink
another optimization for livecharts2 #319
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfagun74 committed Jan 10, 2024
1 parent 76bc42a commit 18d8746
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gamevault/UserControls/GameSettingsUserControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
<local:IconButton Content="Open Directory" Icon="{DynamicResource IconGameSettingsFolder}" Width="145" Height="33" Margin="10,0,0,0" MouseLeftButtonUp="OpenDirectory_Click"/>
</StackPanel>
<TextBlock Text="Disk Usage" FontSize="15" FontWeight="Bold" TextDecorations="Underline" Margin="0,20,0,0"/>
<lvc:PieChart x:Name="uiDiscUsagePieChart" Width="600" Height="350" InitialRotation="-90" IsClockwise="True" HorizontalAlignment="Left" Margin="0,10,0,0" LegendPosition="Right"/>
<lvc:PieChart x:Name="uiDiscUsagePieChart" Width="600" Height="400" InitialRotation="-90" IsClockwise="True" HorizontalAlignment="Left" Margin="0,10,0,0" LegendPosition="Right"/>
<StackPanel Margin="150,0,0,0" HorizontalAlignment="Left">
<TextBlock Text="Total Disk Size" FontSize="15" FontWeight="Bold" />
<TextBlock x:Name="uiTxtAllInstalledGamesSize" FontSize="15" FontWeight="Bold" HorizontalAlignment="Center"/>
Expand Down
22 changes: 12 additions & 10 deletions gamevault/UserControls/GameSettingsUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ private void InitDiskUsagePieChart()
if (percentages[i] > 5)
continue;
if (percentages[i] == 0)
continue;
totalFreeSpacePercentage -= (5 - percentages[i]);
percentages[i] = 5;
}
Expand All @@ -275,16 +278,15 @@ private void InitDiskUsagePieChart()
// Outer-Label
series.DataLabelsPosition = LiveChartsCore.Measure.PolarLabelsPosition.Outer;
series.DataLabelsSize = 15;
series.DataLabelsPadding.Top = 15;
series.DataLabelsPadding.Right = 15;
series.DataLabelsPadding.Bottom = 15;
series.DataLabelsPadding.Left = 15;
series.DataLabelsPaint = color;
series.DataLabelsFormatter = point => $"{humanReadableSize}";
series.ToolTipLabelFormatter = point => $"{point.StackedValue!.Share:P2}";
//ToolTip
series.ToolTipLabelFormatter = (chartPoint) => $"{humanReadableSize}";
series.DataLabelsPadding = new LiveChartsCore.Drawing.Padding(10);
if (size != 0)
{
series.DataLabelsPaint = color;
series.DataLabelsFormatter = point => $"{humanReadableSize}";
series.ToolTipLabelFormatter = point => $"{point.StackedValue!.Share:P2}";
}
index++;
});
App.Current.Dispatcher.Invoke((Action)delegate
Expand Down

0 comments on commit 18d8746

Please sign in to comment.