migrate chart stuff to its own tile control.
ADD
WalletWasabi.Fluent/ViewModels/Wallets/Home/Tiles/WalletPieChartTileViewModel.cs
+using System.Collections.Generic;
+using NBitcoin;
+using WalletWasabi.Wallets;
+
+namespace WalletWasabi.Fluent.ViewModels.Wallets.Home.Tiles
+{
+ public readonly struct DataLegend
+ {
+ public DataLegend(Money amount, string label, string hexColor, double percentShare)
+ {
+ Amount = amount;
+ Label = label;
+ HexColor = hexColor;
+ PercentShare = percentShare;
+ }
+
+ public Money Amount { get; }
+ public string Label { get; }
+ public string HexColor { get; }
+ public double PercentShare { get; }
+ }
+
+ public partial class WalletPieChartTileViewModel : ViewModelBase
+ {
+ [AutoNotify] private IList<(string color, double percentShare)> _testDataPoints;
+ [AutoNotify] private IList<DataLegend> _testDataPointsLegend;
+
+ public WalletPieChartTileViewModel(Wallet wallet)
+ {
+ TestDataPoints = new List<(string, double)>()
+ {
+ ("#72BD81", 0.8d),
+ ("#F9DE7D", 0.2d)
+ };
+
+ TestDataPointsLegend = new List<DataLegend>
+ {
+ new (Money.Parse("0.77508"),"Private", "#F9DE7D", 0.2 ),
+ new (Money.Parse("3.10032"),"Not Private", "#72BD81", 0.8)
+ };
+ }
+ }
+}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/WalletViewModel.cs
@@ -17,26 +17,11 @@ using WalletWasabi.Wallets;
namespace WalletWasabi.Fluent.ViewModels.Wallets
{
- public readonly struct DataLegend
- {
- public DataLegend(Money amount, string label, string hexColor, double percentShare)
- {
- Amount = amount;
- Label = label;
- HexColor = hexColor;
- PercentShare = percentShare;
- }
- public Money Amount { get; }
- public string Label { get; }
- public string HexColor { get; }
- public double PercentShare { get; }
- }
public partial class WalletViewModel : WalletViewModelBase
{
- [AutoNotify] private IList<(string color, double percentShare)> _testDataPoints;
- [AutoNotify] private IList<DataLegend> _testDataPointsLegend;
+
protected WalletViewModel(UiConfig uiConfig, Wallet wallet) : base(wallet)
{
@@ -65,19 +50,9 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
})
.DisposeWith(Disposables);
- TestDataPoints = new List<(string, double)>()
- {
- ("#72BD81", 0.8d),
- ("#F9DE7D", 0.2d)
- };
-
- TestDataPointsLegend = new List<DataLegend>
- {
- new (Money.Parse("0.77508"),"Private", "#F9DE7D", 0.2 ),
- new (Money.Parse("3.10032"),"Not Private", "#72BD81", 0.8)
- };
History = new HistoryViewModel(wallet);
BalanceTile = new WalletBalanceTileViewModel(wallet);
+ WalletPieChart = new WalletPieChartTileViewModel(wallet);
}
private CompositeDisposable Disposables { get; set; }
@@ -88,6 +63,8 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets
public WalletBalanceTileViewModel BalanceTile { get; }
+ public WalletPieChartTileViewModel WalletPieChart { get; }
+
protected override void OnNavigatedTo(bool isInHistory, CompositeDisposable disposables)
{
base.OnNavigatedTo(isInHistory, disposables);

ADD
WalletWasabi.Fluent/Views/Wallets/Home/Tiles/WalletPieChartTileView.axaml
+<UserControl xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:controls="clr-namespace:WalletWasabi.Fluent.Controls"
+ xmlns:wallets="clr-namespace:WalletWasabi.Fluent.ViewModels.Wallets.Home.Tiles"
+ xmlns:converters="clr-namespace:WalletWasabi.Fluent.Converters"
+ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+ x:Class="WalletWasabi.Fluent.Views.Wallets.Home.Tiles.WalletPieChartTileView">
+ <Border ClipToBounds="False" CornerRadius="5" Background="#2b2b2b" Margin="6" Padding="16"
+ BoxShadow="{DynamicResource InfoBoxShadow}">
+ <DockPanel>
+ <TextBlock Text="Wallet Privacy Status" DockPanel.Dock="Top" />
+ <DockPanel LastChildFill="True" TextBlock.FontSize="11">
+
+ <StackPanel DockPanel.Dock="Top">
+ <TextBlock>Coin Privacy</TextBlock>
+ <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">
+ <DockPanel Margin="0,8">
+ <Ellipse DockPanel.Dock="Left" Margin="0,0,8,0" HorizontalAlignment="Left" Width="10"
+ Height="10"
+ Fill="{Binding HexColor, Converter={x:Static converters:ColorStringConverters.HexColorToBrush}}" />
+ <TextBlock DockPanel.Dock="Left" HorizontalAlignment="Left"
+ Text="{Binding Amount, Converter={x:Static converters:MoneyConverters.MoneyToString}}" />
+ <TextBlock DockPanel.Dock="Right" Margin="8,0,0,0" HorizontalAlignment="Right"
+ Text="{Binding PercentShare, StringFormat=\{0:P1\}}" />
+ <TextBlock DockPanel.Dock="Right" HorizontalAlignment="Right" Text="{Binding Label}" />
+ </DockPanel>
+ </DataTemplate>
+ </ItemsRepeater.ItemTemplate>
+ <ItemsRepeater.Layout>
+ <StackLayout />
+ </ItemsRepeater.Layout>
+ </ItemsRepeater>
+
+ <Panel Margin="8" VerticalAlignment="Center" HorizontalAlignment="Center">
+ <controls:RingChartControl DataPoints="{Binding TestDataPoints}" />
+ </Panel>
+ </DockPanel>
+ </DockPanel>
+ </Border>
+
+</UserControl>
\ No newline at end of file

ADD
WalletWasabi.Fluent/Views/Wallets/Home/Tiles/WalletPieChartTileView.axaml.cs
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace WalletWasabi.Fluent.Views.Wallets.Home.Tiles
+{
+ public class WalletPieChartTileView : UserControl
+ {
+ public WalletPieChartTileView()
+ {
+ InitializeComponent();
+ }
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+ }
+}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/Views/Wallets/WalletView.axaml
WalletWasabi.Fluent/Views/Wallets/WalletView.axaml
c:ResponsivePanel.ColumnSpan="1, 1, 1" c:ResponsivePanel.RowSpan="1, 1, 1" />
<Border CornerRadius="4" Margin="4" Background="Blue"
c:ResponsivePanel.ColumnSpan="1, 1, 1" c:ResponsivePanel.RowSpan="1, 1, 1" />
- <Border CornerRadius="4" Margin="4" Background="Yellow"
- c:ResponsivePanel.ColumnSpan="1, 1, 1" c:ResponsivePanel.RowSpan="1, 1, 2" />
+
+ <tiles:WalletPieChartTileView DataContext="{Binding WalletPieChart}" c:ResponsivePanel.ColumnSpan="1, 1, 1" c:ResponsivePanel.RowSpan="1, 1, 2" />
+
<tiles:WalletBalanceChartTileView
c:ResponsivePanel.ColumnSpan="1, 2, 2" c:ResponsivePanel.RowSpan="1, 2, 2" />
</c:ResponsivePanel>

migrate chart stuff to its own tile control.