using Microsoft.AspNetCore.Components; using Plotly.Blazor; using Plotly.Blazor.Traces; using Schaad.Accounting.Interfaces; namespace Schaad.Accounting.UI.Components.Pages.Charts; public partial class BookingTextBreakdown : ComponentBase { private PlotlyChart chart = null!; private Config? config; private Plotly.Blazor.Layout? layout; private IList? data; [Parameter, EditorRequired] public string AccountId { get; set; } = null!; [Inject] private IChartService chartService { get; set; } = null!; protected override async Task OnInitializedAsync() { config = new Config { Responsive = true }; layout = new Plotly.Blazor.Layout { Title = new Plotly.Blazor.LayoutLib.Title { Text = "Nach Buchungstext" } }; var totals = await chartService.GetBookingTextTotalsAsync(AccountId); data = new List { new Pie { // Values are shown as their absolute magnitude - a pie slice can't represent a signed amount. Values = totals.Select(t => (object)Math.Abs(t.Value)).ToList(), Labels = totals.Select(t => (object)t.Name).ToList() } }; } }