From a8d79a824199ad8e8d6eb3d6a2f6374b1b8df516 Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 7 Apr 2026 15:35:35 +0200 Subject: [PATCH] feat(09-03): add chart panel to StorageView with toggle and localization - Update StorageView.xaml: DataGrid top, GridSplitter, chart panel bottom - Add PieChart and CartesianChart with MultiDataTrigger visibility - Add radio buttons for donut/bar chart toggle in left panel - Create BytesLabelConverter for chart tooltip formatting - Add stor.chart.* localization keys in EN and FR resx files Co-Authored-By: Claude Opus 4.6 (1M context) --- .../Localization/Strings.fr.resx | 6 + SharepointToolbox/Localization/Strings.resx | 6 + .../Views/Converters/BytesLabelConverter.cs | 23 +++ SharepointToolbox/Views/Tabs/StorageView.xaml | 167 ++++++++++++++---- 4 files changed, 166 insertions(+), 36 deletions(-) create mode 100644 SharepointToolbox/Views/Converters/BytesLabelConverter.cs diff --git a/SharepointToolbox/Localization/Strings.fr.resx b/SharepointToolbox/Localization/Strings.fr.resx index e40c501..6d0f8a1 100644 --- a/SharepointToolbox/Localization/Strings.fr.resx +++ b/SharepointToolbox/Localization/Strings.fr.resx @@ -378,4 +378,10 @@ Sélectionnez au moins un site. + + Stockage par type de fichier + Graphique en anneau + Graphique en barres + Type de graphique : + Exécutez une analyse pour voir la répartition par type de fichier. diff --git a/SharepointToolbox/Localization/Strings.resx b/SharepointToolbox/Localization/Strings.resx index d728e0e..d000dcb 100644 --- a/SharepointToolbox/Localization/Strings.resx +++ b/SharepointToolbox/Localization/Strings.resx @@ -378,4 +378,10 @@ Select at least one site to scan. + + Storage by File Type + Donut Chart + Bar Chart + Chart View: + Run a storage scan to see file type breakdown. diff --git a/SharepointToolbox/Views/Converters/BytesLabelConverter.cs b/SharepointToolbox/Views/Converters/BytesLabelConverter.cs new file mode 100644 index 0000000..92932bc --- /dev/null +++ b/SharepointToolbox/Views/Converters/BytesLabelConverter.cs @@ -0,0 +1,23 @@ +using System.Globalization; +using System.Windows.Data; + +namespace SharepointToolbox.Views.Converters; + +/// +/// Converts a long byte value to a human-readable label for chart axes and tooltips. +/// Similar to BytesConverter but implements IValueConverter for XAML binding. +/// +public class BytesLabelConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is not long bytes) return value?.ToString() ?? ""; + if (bytes < 1024) return $"{bytes} B"; + if (bytes < 1024 * 1024) return $"{bytes / 1024.0:F1} KB"; + if (bytes < 1024 * 1024 * 1024) return $"{bytes / (1024.0 * 1024):F1} MB"; + return $"{bytes / (1024.0 * 1024 * 1024):F2} GB"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + => throw new NotSupportedException(); +} diff --git a/SharepointToolbox/Views/Tabs/StorageView.xaml b/SharepointToolbox/Views/Tabs/StorageView.xaml index 16b5788..b22ba13 100644 --- a/SharepointToolbox/Views/Tabs/StorageView.xaml +++ b/SharepointToolbox/Views/Tabs/StorageView.xaml @@ -2,7 +2,8 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:loc="clr-namespace:SharepointToolbox.Localization" - xmlns:conv="clr-namespace:SharepointToolbox.Views.Converters"> + xmlns:conv="clr-namespace:SharepointToolbox.Views.Converters" + xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"> + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +