Salvataggio di TUTTI i valori da plottare
This commit is contained in:
@@ -30,16 +30,8 @@
|
||||
<input class="form-control" @bind="@maxRecord" />
|
||||
<span class="input-group-text small">Sample Sec Time</span>
|
||||
<input class="form-control" @bind="@sampleSecMin" />
|
||||
|
||||
}
|
||||
|
||||
</div>
|
||||
@*@if (showParam)
|
||||
{
|
||||
<div>
|
||||
<b>Num Val</b> <input @bind="@maxRecord" /> <b>Sample sec time</b> <input @bind="@sampleSecMin" />
|
||||
</div>
|
||||
}*@
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
|
||||
@@ -17,8 +17,14 @@ namespace MP.MONO.UI.Components
|
||||
#region Protected Fields
|
||||
|
||||
protected DateTime lastRec = DateTime.Now.AddMinutes(-1);
|
||||
protected List<chartJsData.chartJsTSerie> LevelVal = new List<chartJsData.chartJsTSerie>();
|
||||
protected int sampleSecMin = 1;
|
||||
|
||||
protected Dictionary<string, List<chartJsData.chartJsTSerie>> plotData = new Dictionary<string, List<chartJsData.chartJsTSerie>>();
|
||||
|
||||
protected List<chartJsData.chartJsTSerie> LevelVal
|
||||
{
|
||||
get => plotData[SelectedParam] ?? new List<chartJsData.chartJsTSerie>();
|
||||
}
|
||||
protected double sampleSecMin = 1;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
@@ -28,13 +34,6 @@ namespace MP.MONO.UI.Components
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
//protected string cssSel(string ParamName)
|
||||
//{
|
||||
// string answ = ParamName == SelVal ? "fa-solid fa-chevron-right" : "";
|
||||
// return answ;
|
||||
|
||||
//}
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected string _selParam { get; set; } = "";
|
||||
@@ -43,6 +42,10 @@ namespace MP.MONO.UI.Components
|
||||
|
||||
protected string? MinVal { get; set; } = null;
|
||||
|
||||
protected Dictionary<string, string> listMinVal = new Dictionary<string, string>();
|
||||
protected Dictionary<string, string> listMaxVal = new Dictionary<string, string>();
|
||||
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
@@ -61,8 +64,11 @@ namespace MP.MONO.UI.Components
|
||||
{
|
||||
// salvo
|
||||
_selParam = value;
|
||||
// resetto TimeSerie
|
||||
LevelVal = new List<chartJsData.chartJsTSerie>();
|
||||
// cerco se ho in dictionary...
|
||||
if (!plotData.ContainsKey(value))
|
||||
{
|
||||
plotData.Add(value, new List<chartJsData.chartJsTSerie>());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,6 +92,36 @@ namespace MP.MONO.UI.Components
|
||||
// prendo SOLO il dato della TS richiesta
|
||||
if (ListRecords != null)
|
||||
{
|
||||
// accodo in blocco tutti i valori...
|
||||
foreach (var item in ListRecords)
|
||||
{
|
||||
// cerco se ci sono min/max del valore indicato...
|
||||
if (!listMinVal.ContainsKey(item.Title))
|
||||
{
|
||||
listMinVal.Add(item.Title, $"{item.MinVal:N0}");
|
||||
}
|
||||
if (!listMaxVal.ContainsKey(item.Title))
|
||||
{
|
||||
listMaxVal.Add(item.Title, $"{item.MaxVal:N0}");
|
||||
}
|
||||
// verifico dictionary se mancasse...
|
||||
if (!plotData.ContainsKey(item.Title))
|
||||
{
|
||||
plotData.Add(item.Title, new List<chartJsData.chartJsTSerie>());
|
||||
}
|
||||
// ora accodo il valore
|
||||
|
||||
if (plotData.ContainsKey(item.Title))
|
||||
{
|
||||
plotData[item.Title].Add(new chartJsData.chartJsTSerie() { x = adesso, y = item.ValueNum });
|
||||
// verifico limite visualizzazione
|
||||
if (plotData[item.Title].Count > maxRecord)
|
||||
{
|
||||
plotData[item.Title].RemoveRange(0, plotData[item.Title].Count - maxRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
#if false
|
||||
var newData = ListRecords.Where(x => x.Title == SelectedParam).FirstOrDefault();
|
||||
// lo accodo
|
||||
if (newData != null)
|
||||
@@ -100,7 +136,8 @@ namespace MP.MONO.UI.Components
|
||||
{
|
||||
LevelVal.RemoveRange(0, LevelVal.Count - maxRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
||||
Reference in New Issue
Block a user