diff --git a/MP.Stats/Components/ChartScarti.razor b/MP.Stats/Components/ChartScarti.razor
index ec627be6..86b7d6ce 100644
--- a/MP.Stats/Components/ChartScarti.razor
+++ b/MP.Stats/Components/ChartScarti.razor
@@ -4,7 +4,7 @@
- @foreach (var item in @CurrData)
+ @foreach (var item in @ParetoData)
{
-
@item.label
diff --git a/MP.Stats/Components/ChartScarti.razor.cs b/MP.Stats/Components/ChartScarti.razor.cs
index ac07c1ed..f5460e9e 100644
--- a/MP.Stats/Components/ChartScarti.razor.cs
+++ b/MP.Stats/Components/ChartScarti.razor.cs
@@ -127,7 +127,8 @@ namespace MP.Stats.Components
AspectRatio = 2.5
};
- protected List CurrData { get; set; } = new List();
+ protected List ParetoData { get; set; } = new List();
+ protected List TSData { get; set; } = new List();
//protected override async Task OnAfterRenderAsync(bool firstRender)
//{
@@ -152,12 +153,12 @@ namespace MP.Stats.Components
List GetBarChartLabels()
{
- var answ = CurrData.Select(x => x.label).ToList();
+ var answ = ParetoData.Select(x => x.label).ToList();
return answ;
}
List GetLineChartLabels()
{
- var answ = CurrData.Select(x => x.label).ToList();
+ var answ = TSData.Select(x => x.TLabel.ToString()).ToList();
return answ;
}
@@ -166,8 +167,8 @@ namespace MP.Stats.Components
var answ = new BarChartDataset
{
Label = "Pareto Causali Scarto",
- Data = CurrData.Select(x => x.value).ToList(),
- BackgroundColor = backgroundColors(CurrData.Count),
+ Data = ParetoData.Select(x => x.value).ToList(),
+ BackgroundColor = backgroundColors(ParetoData.Count),
//BorderColor = borderColors,
HoverBorderWidth = 5
};
@@ -178,10 +179,11 @@ namespace MP.Stats.Components
var answ = new LineChartDataset
{
Label = "Numero Scarti Periodo",
- Data = CurrData.Select(x => x.value).ToList(),
- BackgroundColor = backgroundColors(CurrData.Count),
+ Data = TSData.Select(x => x.Value).ToList(),
+ BackgroundColor = backgroundColors(1),
Fill = true,
PointRadius = 2,
+ SteppedLine=true,
BorderDash = new List { }
};
return answ;
@@ -217,11 +219,16 @@ namespace MP.Stats.Components
{
if (ListScarti != null)
{
- CurrData = ListScarti
+ ParetoData = ListScarti
.GroupBy(x => x.Causale)
.Select(y => new ChartKV() { label = y.First().Descrizione, value = y.Sum(c => c.Qta) })
.OrderByDescending(x => x.value)
.ToList();
+
+ TSData = ListScarti
+ .Select(y => new ChartTS() { TLabel = y.DataOraRif, Value = y.Qta })
+ .OrderBy(x => x.TLabel)
+ .ToList();
}
}
}
diff --git a/MP.Stats/Data/ChartTS.cs b/MP.Stats/Data/ChartTS.cs
new file mode 100644
index 00000000..18d64e24
--- /dev/null
+++ b/MP.Stats/Data/ChartTS.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace MP.Stats.Data
+{
+ public class ChartTS
+ {
+ #region Public Properties
+
+ public DateTime TLabel { get; set; } = DateTime.Now;
+ public double Value { get; set; } = 0;
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file