working pie chart.
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/Tiles/WalletPieChartTileViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/Tiles/WalletPieChartTileViewModel.cs
+using System;
using System.Collections.Generic;
+using System.Linq;
+using System.Reactive;
using NBitcoin;
+using WalletWasabi.Gui;
using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.Tiles
@@ -22,21 +26,43 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.Tiles
public partial class WalletPieChartTileViewModel : TileViewModel
{
- [AutoNotify] private IList<(string color, double percentShare)> _testDataPoints;
- [AutoNotify] private IList<DataLegend> _testDataPointsLegend;
+ [AutoNotify] private IList<(string color, double percentShare)>? _testDataPoints;
+ [AutoNotify] private IList<DataLegend>? _testDataPointsLegend;
- public WalletPieChartTileViewModel(Wallet wallet)
+ private readonly Wallet _wallet;
+ private readonly Config _config;
+
+
+ public WalletPieChartTileViewModel(Wallet wallet, Config config, IObservable<Unit> balanceChanged)
+ {
+ _wallet = wallet;
+ _config = config;
+
+ balanceChanged.Subscribe(_ => Update());
+
+ Update();
+ }
+
+ private void Update()
{
+ var privateCoins = _wallet.Coins.FilterBy(x => x.HdPubKey.AnonymitySet > _config.PrivacyLevelStrong);
+ var normalCoins = _wallet.Coins.FilterBy(x => x.HdPubKey.AnonymitySet < _config.PrivacyLevelStrong);
+ var totalCount = (double)_wallet.Coins.Count();
+
+ var pcPrivate = (privateCoins.Count() / totalCount);
+ var pcNormal = (normalCoins.Count() / totalCount);
+
+
TestDataPoints = new List<(string, double)>()
{
- ("#72BD81", 0.8d),
- ("#F9DE7D", 0.2d)
+ ("#72BD81", pcPrivate),
+ ("#F9DE7D", pcNormal)
};
TestDataPointsLegend = new List<DataLegend>
{
- new (Money.Parse("0.77508"), "Private", "#F9DE7D", 0.2 ),
- new (Money.Parse("3.10032"), "Not Private", "#72BD81", 0.8)
+ new (privateCoins.TotalAmount(), "Private", "#F9DE7D", pcPrivate),
+ new (normalCoins.TotalAmount(), "Not Private", "#72BD81", pcNormal)
};
}
}

MODIFY
WalletWasabi.Fluent/Views/Wallets/Home/Tiles/WalletBalanceChartTileView.axaml
WalletWasabi.Fluent/Views/Wallets/Home/Tiles/WalletBalanceChartTileView.axaml
</Style>
<!-- LineChart YAxis Labels -->
<Style Selector="c|LineChart.yAxisLabels">
- <Setter Property="YAxisLabelForeground" Value="{DynamicResource TextForegroundColor}" />
<Setter Property="YAxisLabelAngle" Value="0" />
<Setter Property="YAxisLabelOffset" Value="-10,0" />
<Setter Property="YAxisLabelAlignment" Value="Right" />

MODIFY
WalletWasabi.Fluent/Views/Wallets/Home/Tiles/WalletPieChartTileView.axaml
WalletWasabi.Fluent/Views/Wallets/Home/Tiles/WalletPieChartTileView.axaml
<DockPanel>
<TextBlock Text="Wallet Privacy Status" DockPanel.Dock="Top" />
<DockPanel LastChildFill="True" TextBlock.FontSize="12">
-
- <StackPanel DockPanel.Dock="Top">
- <TextBlock Opacity="0.5">in Percentage %</TextBlock>
- </StackPanel>
-
<ItemsRepeater DockPanel.Dock="Bottom" Margin="0,0,0,-8" Items="{Binding TestDataPointsLegend}">
<ItemsRepeater.ItemTemplate>
<DataTemplate x:DataType="wallets:DataLegend">

working pie chart.