@using EgwCoreLib.Lux.Data.Services @inject CalcRuidService Calc @inject IJSRuntime JSRuntime

Statistiche Storiche

@code { private DateTime from = DateTime.Now.AddHours(-24); private DateTime to = DateTime.Now; private List labels = new(); private List reqData = new(); private List avgData = new(); private List maxData = new(); private async Task Load() { var stats = await Calc.GetStatsRangeAsync(from, to); labels = stats.HourLabels; reqData = stats.Requests; avgData = stats.AvgProcessing; maxData = stats.MaxProcessing; await JSRuntime.InvokeVoidAsync("chartsInterop.createChart", "chartHistoricalRequests", new { type = "line", data = new { labels, datasets = new[] { new { label = "Richieste/ora", data = reqData, borderColor = "blue" } } } }); await JSRuntime.InvokeVoidAsync("chartsInterop.createChart", "chartHistoricalAvg", new { type = "line", data = new { labels, datasets = new[] { new { label = "Tempo medio (s)", data = avgData, borderColor = "orange" } } } }); await JSRuntime.InvokeVoidAsync("chartsInterop.createChart", "chartHistoricalMax", new { type = "line", data = new { labels, datasets = new[] { new { label = "Tempo massimo (s)", data = maxData, borderColor = "red" } } } }); } }