using Microsoft.AspNetCore.Components; using Plotly.Blazor; using Plotly.Blazor.LayoutLib; using Plotly.Blazor.Traces; using Schaad.Accounting.Interfaces; namespace Schaad.Accounting.UI.Components.Pages.Charts; public partial class BookingTextOverTime : ComponentBase { private PlotlyChart chart = null!; private Config? config; private Plotly.Blazor.Layout? layout; private IList data = new List(); [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 Title { Text = "Nach Buchungstext im Verlauf" }, BarMode = BarModeEnum.Stack, XAxis = new List { new() { Type = Plotly.Blazor.LayoutLib.XAxisLib.TypeEnum.Date } } }; var newData = new List(); var dataSeries = await chartService.GetBookingTextExpensesPerMonthAsync(AccountId); foreach (var dataSerie in dataSeries) { newData.Add(new Bar { Name = dataSerie.Name, X = dataSerie.X.Select(d => (object)d).ToList(), Y = dataSerie.Y.Select(d => (object)d).ToList(), }); } data = newData; await base.OnInitializedAsync(); } }