diff --git a/MP.Stats/Components/ChartTrends.razor b/MP.Stats/Components/ChartTrends.razor
index ca63bd38..a4b1dd91 100644
--- a/MP.Stats/Components/ChartTrends.razor
+++ b/MP.Stats/Components/ChartTrends.razor
@@ -34,7 +34,16 @@
@foreach (var item in @ParetoData.OrderBy(x => x.label).ToList())
{
- @item.label
+
+ @if (ShowRem)
+ {
+
+ }
+ else
+ {
+ @item.label
+ }
+
@item.value
}
diff --git a/MP.Stats/Components/ChartTrends.razor.cs b/MP.Stats/Components/ChartTrends.razor.cs
index 33b5902d..95e3b6f8 100644
--- a/MP.Stats/Components/ChartTrends.razor.cs
+++ b/MP.Stats/Components/ChartTrends.razor.cs
@@ -8,6 +8,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
+using System.Threading.Tasks;
namespace MP.Stats.Components
{
@@ -21,6 +22,12 @@ namespace MP.Stats.Components
[Parameter]
public EventCallback EC_CodFluxSel { get; set; }
+ [Parameter]
+ public EventCallback EC_IdxMaccRem { get; set; }
+
+ [Parameter]
+ public bool ShowRem { get; set; } = false;
+
[Parameter]
public List RawData
{
@@ -39,6 +46,11 @@ namespace MP.Stats.Components
#endregion Public Properties
+ private async Task RemoveMachine(string idxMacc)
+ {
+ await EC_IdxMaccRem.InvokeAsync(idxMacc);
+ }
+
#region Protected Enums
protected enum PeriodoSel
diff --git a/MP.Stats/Pages/TrendAnalysis.razor b/MP.Stats/Pages/TrendAnalysis.razor
index a33d5541..cdeb2cb4 100644
--- a/MP.Stats/Pages/TrendAnalysis.razor
+++ b/MP.Stats/Pages/TrendAnalysis.razor
@@ -16,7 +16,7 @@
{
if (MaccSelValid)
{
-
+
}
else
{
diff --git a/MP.Stats/Pages/TrendAnalysis.razor.cs b/MP.Stats/Pages/TrendAnalysis.razor.cs
index 005eb56a..8963512c 100644
--- a/MP.Stats/Pages/TrendAnalysis.razor.cs
+++ b/MP.Stats/Pages/TrendAnalysis.razor.cs
@@ -20,6 +20,8 @@ namespace MP.Stats.Pages
public void Dispose()
{
MServ.EA_SearchUpdated -= OnSeachUpdated;
+ PlotRecords.Clear();
+ SearchRecords.Clear();
}
public async void OnSeachUpdated()
@@ -38,11 +40,23 @@ namespace MP.Stats.Pages
protected string CodFluxSel = "*";
protected string fileName = "TrendAnalysis.csv";
- protected int TotalCount = 0;
protected int SelCount = 0;
+ protected int TotalCount = 0;
#endregion Protected Fields
+ #region Protected Enums
+
+ protected enum ResolutionLevel
+ {
+ Low,
+ Med,
+ High,
+ Custom
+ }
+
+ #endregion Protected Enums
+
#region Protected Properties
protected List CodFluxList { get; set; } = new List() { "Energy", "Parameter" };
@@ -50,6 +64,14 @@ namespace MP.Stats.Pages
[Inject]
protected IJSRuntime JSRuntime { get; set; }
+ ///
+ /// Verifica validità selezione macchine
+ ///
+ protected bool MaccSelValid
+ {
+ get => currFilter.MaccSelValid;
+ }
+
///
/// Numero max di punti da mostrare
///
@@ -72,6 +94,47 @@ namespace MP.Stats.Pages
[Inject]
protected NavigationManager NavManager { get; set; }
+ protected ResolutionLevel ReqRes
+ {
+ get => _reqRes;
+ set
+ {
+ if (_reqRes != value)
+ {
+ _reqRes = value;
+ if (value < ResolutionLevel.Custom)
+ {
+ int numSel = currFilter.ListIdxMaccSel.Count;
+ // verifico selcount valido... che sia almeno MaxDisp/
+ if (SelCount == 0)
+ {
+ SelCount = TotalCount * numSel / NumMacc;
+ }
+ int scale = 256;
+ switch (value)
+ {
+ case ResolutionLevel.Low:
+ MaxPoints = (int)Math.Round(SelCount / numSel / 32 / (double)scale) * scale;
+ break;
+
+ case ResolutionLevel.Med:
+ MaxPoints = (int)Math.Round(SelCount / numSel / 8 / (double)scale) * scale;
+ break;
+
+ case ResolutionLevel.High:
+ MaxPoints = (int)Math.Round(SelCount / numSel / (double)scale) * scale;
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+ // limite minimo 256...
+ MaxPoints = MaxPoints < 256 ? 256 : MaxPoints;
+ }
+ }
+
[Inject]
protected MpStatsService StatService { get; set; }
@@ -102,7 +165,6 @@ namespace MP.Stats.Pages
isLoading = false;
}
-
protected async Task ResetFilter(SelectData newFilter)
{
SearchRecords = null;
@@ -141,57 +203,17 @@ namespace MP.Stats.Pages
#region Private Fields
private int _maxPoints = 256;
+ private ResolutionLevel _reqRes = ResolutionLevel.Low;
private List ConfigList;
+ private int MaxDisplay = 10;
+ private int NumMacc = 0;
private List PlotRecords;
- private List SearchRecords;
- protected ResolutionLevel ReqRes
- {
- get => _reqRes;
- set
- {
- if (_reqRes != value)
- {
- _reqRes = value;
- if (value < ResolutionLevel.Custom)
- {
- int numSel = currFilter.ListIdxMaccSel.Count;
- // verifico selcount valido... che sia almeno MaxDisp/
- if (SelCount == 0)
- {
- SelCount = TotalCount * numSel / NumMacc;
- }
- int scale = 256;
- switch (value)
- {
- case ResolutionLevel.Low:
- MaxPoints = (int)Math.Round(SelCount / numSel / 32 / (double)scale) * scale;
- break;
- case ResolutionLevel.Med:
- MaxPoints = (int)Math.Round(SelCount / numSel / 8 / (double)scale) * scale;
- break;
- case ResolutionLevel.High:
- MaxPoints = (int)Math.Round(SelCount / numSel / (double)scale) * scale;
- break;
- default:
- break;
- }
- }
- }
- // limite minimo 256...
- MaxPoints = MaxPoints < 256 ? 256 : MaxPoints;
- }
- }
- private ResolutionLevel _reqRes = ResolutionLevel.Low;
-
- protected enum ResolutionLevel
- {
- Low,
- Med,
- High,
- Custom
- }
+ ///
+ /// Dizionario liste valori da mostrare
+ ///
+ private Dictionary> SearchRecords = new Dictionary>();
#endregion Private Fields
@@ -213,8 +235,6 @@ namespace MP.Stats.Pages
#endregion Private Properties
- private int MaxDisplay = 10;
-
#region Private Methods
///
@@ -235,15 +255,11 @@ namespace MP.Stats.Pages
{
// in primis suddivido in un dizionario x ogni macchina...
PlotRecords = new List();
- Dictionary> grpDict = SearchRecords
- .GroupBy(o => o.IdxMacchina)
- .ToDictionary(g => g.Key, g => g.ToList());
-
// per ogni valore recupero timeserie downsampled fino al num max di quelle ottenibili...
int numAdd = 0;
SelCount = 0;
var listSel = currFilter.ListIdxMaccSel;
- foreach (var item in grpDict)
+ foreach (var item in SearchRecords)
{
// verifico se sia tra le macchine selezionate...
if (listSel.Contains(item.Key))
@@ -281,20 +297,19 @@ namespace MP.Stats.Pages
var listMacchine = await StatService.MachineList(true);
NumMacc = listMacchine.Count;
// ciclo caricando info x ogni macchina selezionata...
- SearchRecords = new List();
- PlotRecords = new List();
+ SearchRecords = new Dictionary>();
if (currFilter.ListIdxMaccSel.Count > 0)
{
foreach (var idxMacc in currFilter.ListIdxMaccSel)
{
currFilter.IdxMacchina = idxMacc;
var tempRec = await StatService.FluxLogRawData(currFilter, CodFluxSel, MServ.SearchVal);
- SearchRecords.AddRange(tempRec);
+ SearchRecords.Add(idxMacc, tempRec);
}
}
#if false
- SearchRecords = await StatService.FluxLogRawData(currFilter, CodFluxSel, MServ.SearchVal);
+ SearchRecords = await StatService.FluxLogRawData(currFilter, CodFluxSel, MServ.SearchVal);
#endif
TotalCount = SearchRecords.Count;
// se ho un elenco di macchine mostro grafici, altrimenti resoconto
@@ -303,16 +318,26 @@ namespace MP.Stats.Pages
isLoading = false;
}
- #endregion Private Methods
-
- private int NumMacc = 0;
-
///
- /// Verifica validità selezione macchine
+ /// Elimina da dict macchina indicata
///
- protected bool MaccSelValid
+ ///
+ private async Task RemoveMachine(string idxMacc)
{
- get => currFilter.MaccSelValid;
+ // in primis se contiene spazio --> prendo prima aprte che è idxMacc...
+ if (idxMacc.Contains(" "))
+ {
+ var sVals = idxMacc.Split(' ');
+ idxMacc = sVals[0];
+ }
+ if (SearchRecords.ContainsKey(idxMacc))
+ {
+ currFilter.ListIdxMaccSel.Remove(idxMacc);
+ SearchRecords.Remove(idxMacc);
+ await ReloadData();
+ }
}
+
+ #endregion Private Methods
}
}
\ No newline at end of file