- @*
*@
@@ -50,8 +47,8 @@
-
diff --git a/MP.Stats/Pages/Test.razor.cs b/MP.Stats/Pages/Test.razor.cs
index 0c98050d..1dc6b7ec 100644
--- a/MP.Stats/Pages/Test.razor.cs
+++ b/MP.Stats/Pages/Test.razor.cs
@@ -67,9 +67,6 @@ namespace MP.Stats.Pages
protected int lineTens { get; set; } = 0;
-#if false
- PieChart
pieChart;
-#endif
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
@@ -86,22 +83,6 @@ namespace MP.Stats.Pages
object horizontalLineChartOptions = new
{
- //Title = new
- //{
- // Display = true,
- // Text = "Line chart sample"
- //},
- //Scales = new
- //{
- // XAxes = new object[]
- // {
- // new {
- // //ScaleLabel = new {
- // //Display = true, LabelString = "value" },
- // Stacked = true
- // }
- // }
- //},
Tooltips = new
{
Mode = "nearest",
@@ -129,19 +110,15 @@ namespace MP.Stats.Pages
;
private async Task HandleRedraw()
{
-#if false
- await pieChart.Clear();
- await pieChart.AddLabelsDatasetsAndUpdate(Labels, GetPieChartDataset());
-#endif
// calcolo hist frequenza con EFCore: https://entityframeworkcore.com/knowledge-base/60871048/group-by-and-to-dictionary-in-ef-core-3-1
randData = RandomizeData();
- var histDict = randData.GroupBy(r => r).Select(g => new
- {
- g.Key,
- Count = g.Count()
- }).OrderBy(d => d.Key).ToDictionary(x => x.Key, x => x.Count.ToString());
- histData = histDict.Values.ToArray();
- histLabel = histDict.Keys.Select(x => $"{x}").ToArray();
+ //var histDict = randData.GroupBy(r => r).Select(g => new
+ //{
+ // g.Key,
+ // Count = g.Count()
+ //}).OrderBy(d => d.Key).ToDictionary(x => x.Key, x => x.Count.ToString());
+ //histData = histDict.Values.ToArray();
+ //histLabel = histDict.Keys.Select(x => $"{x}").ToArray();
// calcolo i valori raggruppati in numGroup...
int numGroup = (int)Math.Sqrt(numRec);
@@ -152,11 +129,12 @@ namespace MP.Stats.Pages
{
g.Key,
Count = g.Count()
- }).OrderBy(d => d.Key).ToDictionary(x => x.Key, x => x.Count.ToString());
- histGroupData = histDictGroup.Values.ToArray();
+ }).OrderBy(d => d.Key).ToDictionary(x => x.Key, x => x.Count);
+ histGroupData = histDictGroup.Values.Select(x => $"{x}").ToArray();
histGroupLabel = histDictGroup.Keys.Select(x => $"{x:N2}").ToArray();
-
+ histData = histDictGroup.Values.Select(x => (double)x).ToList();
+ histLabel = histDictGroup.Keys.Select(x => $"{x:N2}").ToList();
dataList = TSData(DateTime.Today.AddHours(-randData.Count), randData).Select(r => new chartJsData.chartJsTSerie()
{ x = r.Key, y = r.Value }).ToList();
@@ -165,9 +143,9 @@ namespace MP.Stats.Pages
bgColors = new List() { "rgba(255, 99, 132, 0.3)", "rgba(255, 159, 64, 0.3)", "rgba(255, 205, 86, 0.3)", "rgba(75, 192, 192, 0.3)", "rgba(54, 162, 235, 0.3)", "rgba(153, 102, 255, 0.3)", "rgba(201, 203, 207, 0.3)" };
}
- protected string[]? histData { get; set; } = null;
+ protected List histData { get; set; } = new List();
- protected string[]? histLabel { get; set; } = null;
+ protected List histLabel { get; set; } = new List();
protected string[]? histGroupData { get; set; } = null;
@@ -180,34 +158,10 @@ namespace MP.Stats.Pages
protected List? dataList { get; set; } = null;
-#if false
-
- PieChartDataset GetPieChartDataset()
- {
- return new PieChartDataset { Label = "# of randoms", Data = RandomizeData(), BackgroundColor = backgroundColors, BorderColor = borderColors };
- }
-
- LineChartDataset GetLineChartDataset()
- {
- return new LineChartDataset { Label = "# of randoms", Data = RandomizeData(), BackgroundColor = backgroundColors, BorderColor = borderColors, Fill = true, PointRadius = 2, BorderDash = new List { } };
- }
-
- BarChartDataset GetBarChartDataset()
- {
- return new BarChartDataset { Label = "# of randoms", Data = RandomizeData(), BackgroundColor = backgroundColors, BorderColor = borderColors, HoverBorderWidth = 5 };
- }
-
- BarChartDataset GetHorizBarChartDataset()
- {
- return new BarChartDataset { Label = "# of randoms", Data = RandomizeData(), BackgroundColor = backgroundColors, BorderColor = borderColors, HoverBorderWidth = 5 };
- }
-#endif
string[] Labels = { "Red", "Blue", "Yellow", "Green", "Purple", "Orange" };
-#if false
- List backgroundColors = new List { ChartColor.Fromrgbaa(255, 99, 132, 0.2f), ChartColor.Fromrgbaa(54, 162, 235, 0.2f), ChartColor.Fromrgbaa(255, 206, 86, 0.2f), ChartColor.Fromrgbaa(75, 192, 192, 0.2f), ChartColor.Fromrgbaa(153, 102, 255, 0.2f), ChartColor.Fromrgbaa(255, 159, 64, 0.2f) };
- List borderColors = new List { ChartColor.Fromrgbaa(255, 99, 132, 1f), ChartColor.Fromrgbaa(54, 162, 235, 1f), ChartColor.Fromrgbaa(255, 206, 86, 1f), ChartColor.Fromrgbaa(75, 192, 192, 1f), ChartColor.Fromrgbaa(153, 102, 255, 1f), ChartColor.Fromrgbaa(255, 159, 64, 1f) };
-#endif
+
+
private List RandomizeData()
{