using Microsoft.AspNetCore.Components; using Plotly.Blazor; using Plotly.Blazor.Traces; using Schaad.Accounting.Datasets.Charts; using Schaad.Accounting.Interfaces; namespace Schaad.Accounting.UI.Components.Pages.Charts; public partial class Assets : ComponentBase { private PlotlyChart chart = null!; private Config? config; private Plotly.Blazor.Layout? layout; private IList? data; [Inject] private IViewService viewService { get; set; } = null!; protected override async Task OnInitializedAsync() { config = ChartTheme.BaseConfig(); layout = ChartTheme.BaseLayout("Vermögen nach Konto"); var accounts = (await viewService.GetAccountViewListAsync()).Where(a => a.Class == ClassIds.Activa); var totals = accounts .Where(a => a.BalanceCHF > 0) .Select(a => new CategoryTotal(a.Name, a.BalanceCHF)) .ToList(); data = new List { ChartTheme.BuildDonutTrace(ChartFormatting.FoldTail(totals)) }; await base.OnInitializedAsync(); } }