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) <noreply@anthropic.com>
This commit is contained in:
23
SharepointToolbox/Views/Converters/BytesLabelConverter.cs
Normal file
23
SharepointToolbox/Views/Converters/BytesLabelConverter.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace SharepointToolbox.Views.Converters;
|
||||
|
||||
/// <summary>
|
||||
/// Converts a long byte value to a human-readable label for chart axes and tooltips.
|
||||
/// Similar to BytesConverter but implements IValueConverter for XAML binding.
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user