@page "/TestCompo" @using EgwCoreLib.Razor.Data; @using EgwCoreLib.Utils; Test

TestCompo

@if (periodo != null) {
Periodo Selezionato: @($"{periodo.Inizio:yyyy/MM/dd}") → @($"{periodo.Fine:yyyy/MM/dd}")
}
@code { protected DtUtils.Periodo? periodo { get; set; } = new DtUtils.Periodo(DtUtils.PeriodSet.ThisTrim); protected async Task setPeriodo(DtUtils.Periodo newPeriodo) { await Task.Delay(1); periodo = newPeriodo; } public List colors = new List(); public List Data = new List(); public List Labels = new List(); protected override async Task OnInitializedAsync() { await Task.Delay(1); } protected override async Task OnParametersSetAsync() { await ReloadData(); await Task.Delay(1); } protected double[] SimData() { List answ = new List(); double currColor = 0; for (int i = 0; i < 10; i++) { currColor = (double)(rnd.Next(10, 100)) / 10; answ.Add(currColor); if(currColor>7) { colors.Add(new DoughnutStyling("#28FF69", "ccc")); } else if (currColor > 3) { colors.Add(new DoughnutStyling("orange", "ccc")); } else { colors.Add(new DoughnutStyling("red", "ccc")); } } return answ.ToArray(); } protected async Task ReloadData() { await Task.Delay(1); } protected Random rnd = new Random(); protected string[] histLabel(int num) { List answ = new List(); for (int i = 0; i < 50; i++) { answ.Add($"LBL_{i:00}"); } return answ.ToArray(); } protected string[] histData(int num) { List answ = new List(); for (int i = 0; i < 50; i++) { answ.Add($"{(double)(rnd.Next(10, 100)) / 10 + i}"); } return answ.ToArray(); } }