98 lines
2.5 KiB
C#
98 lines
2.5 KiB
C#
using EgwCoreLib.Razor.Data;
|
|
using EgwCoreLib.Utils;
|
|
|
|
namespace EgwCoreLib.BlazorTest.Pages
|
|
{
|
|
public partial class TestChart
|
|
{
|
|
#region Public Fields
|
|
|
|
public List<DoughnutStyling> colors = new List<DoughnutStyling>();
|
|
public List<double> Data = new List<double>();
|
|
public List<string> Labels = new List<string>();
|
|
|
|
#endregion Public Fields
|
|
|
|
#region Protected Fields
|
|
|
|
protected Random rnd = new Random();
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
protected DtUtils.Periodo? periodo { get; set; } = new DtUtils.Periodo(DtUtils.PeriodSet.ThisTrim);
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected string[] histData(int num)
|
|
{
|
|
List<string> answ = new List<string>();
|
|
for (int i = 0; i < 50; i++)
|
|
{
|
|
answ.Add($"{(double)(rnd.Next(10, 100)) / 10 + i}");
|
|
}
|
|
return answ.ToArray();
|
|
}
|
|
|
|
protected string[] histLabel(int num)
|
|
{
|
|
List<string> answ = new List<string>();
|
|
for (int i = 0; i < 50; i++)
|
|
{
|
|
answ.Add($"LBL_{i:00}");
|
|
}
|
|
return answ.ToArray();
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
await ReloadData();
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
protected async Task ReloadData()
|
|
{
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
protected async Task setPeriodo(DtUtils.Periodo newPeriodo)
|
|
{
|
|
await Task.Delay(1);
|
|
periodo = newPeriodo;
|
|
}
|
|
|
|
protected double[] SimData()
|
|
{
|
|
List<double> answ = new List<double>();
|
|
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();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
}
|
|
} |