@@ -111,21 +111,21 @@
@item.AlarmDescription
- @item.Duration
+ @Math.Round(item.Duration,2)
|
- @*
+ |
- @if (totalEvents != 0)
+ @if (totalVar != 0)
{
- @calcPerc((double)record.EventCount)
+ @calcPercDur((double)item.Duration)
}
|
- | *@
+ @Math.Round(item.Duration,2)
+
+
}
diff --git a/MP.MONO.UI/Pages/AlarmsAnalysis.razor.cs b/MP.MONO.UI/Pages/AlarmsAnalysis.razor.cs
index 95cafb6..df790c3 100644
--- a/MP.MONO.UI/Pages/AlarmsAnalysis.razor.cs
+++ b/MP.MONO.UI/Pages/AlarmsAnalysis.razor.cs
@@ -168,7 +168,7 @@ namespace MP.MONO.UI.Pages
ListRecordsFreq = SearchRecordsFreq.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
totalCount = SearchRecordsFreq.Count;
totalVar = SearchRecordsFreq.Sum(x => x.EventCount);
- calcolaSoglie();
+ calcolaSoglieFreq();
await Task.Delay(1);
}
else
@@ -177,6 +177,7 @@ namespace MP.MONO.UI.Pages
ListRecordsDur = SearchRecordsDur.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
totalCount = SearchRecordsDur.Count;
totalVar = SearchRecordsDur.Sum(x => x.Duration);
+ //calcolaSoglieDur();
await Task.Delay(1);
}
await Task.Delay(1);
@@ -209,15 +210,15 @@ namespace MP.MONO.UI.Pages
{
SearchRecordsDur = CurrentDataService.dbController.AlarmRecGetParetoDur(1, dtStart, dtEnd);
ListRecordsDur= SearchRecordsDur.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
-
+ //calcolaSoglieDur();
}
await ReloadData();
}
private double sogliaGreen = 0;
private double sogliaRed = 1;
- private void calcolaSoglie()
+ private void calcolaSoglieFreq()
{
- int numRecord = SearchRecordsFreq.Count;
+ int numRecord = totalCount;
var firstRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.2)).FirstOrDefault();
var lastRecord = SearchRecordsFreq.Skip((int)(numRecord * 0.8)).FirstOrDefault();
if (firstRecord != null)
@@ -229,19 +230,39 @@ namespace MP.MONO.UI.Pages
sogliaRed = (double)lastRecord.EventCount / totalVar;
}
}
+ private void calcolaSoglieDur()
+ {
+ int numRecord = totalCount;
+ var firstRecord = SearchRecordsDur.Skip((int)(numRecord * 0.2)).FirstOrDefault();
+ var lastRecord = SearchRecordsDur.Skip((int)(numRecord * 0.8)).FirstOrDefault();
+ if (firstRecord != null)
+ {
+ sogliaGreen = (double)firstRecord.Duration / totalVar;
+ }
+ if (lastRecord != null)
+ {
+ sogliaRed = (double)lastRecord.Duration / totalVar;
+ }
+ }
protected void ResetData()
{
currRecord = null;
}
- protected string calcPerc(double numEvent)
+ protected string calcPercFreq(double numEvent)
{
string ans = $"{numEvent / totalVar:P2}";
return ans;
}
+ protected string calcPercDur(double duration)
+ {
+ string ans = $"{duration / totalVar:P2}";
- protected string val(double eventCount)
+ return ans;
+ }
+
+ protected string valFreq(double eventCount)
{
int max = SearchRecordsFreq.Max(a => a.EventCount);
@@ -254,12 +275,25 @@ namespace MP.MONO.UI.Pages
return ans;
}
- protected string styleColourPBar(double eventFreq)
+ protected string valDur(double duration)
+ {
+ double max = SearchRecordsDur.Max(a => a.Duration);
+
+ double divisione = duration / max;
+
+ int percentage = (int)(divisione * 100);
+
+ string ans = $"width: {percentage}%";
+
+ return ans;
+ }
+
+ protected string styleColourPBarFreq(double eventFreq)
{
string ans = "";
var source = ListRecordsFreq;
- calcolaSoglie();
+ //calcolaSoglieDur();
if (eventFreq >= sogliaGreen)
{
@@ -277,7 +311,29 @@ namespace MP.MONO.UI.Pages
return ans;
}
+ protected string styleColourPBarDur(double duration)
+ {
+ string ans = "";
+ var source = ListRecordsFreq;
+ calcolaSoglieFreq();
+
+ if (duration >= sogliaGreen)
+ {
+ ans = "bg-danger";
+ }
+ else if (duration <= sogliaRed)
+ {
+ ans = "bg-success";
+ }
+ else
+ {
+ ans = "bg-warning";
+ }
+
+
+ return ans;
+ }
protected void Select(AlarmFreqDTO selRecord)
{
// applico filtro da selezione
diff --git a/MP.MONO.UI/Resources/ChangeLog.html b/MP.MONO.UI/Resources/ChangeLog.html
index ce23c9e..1b92696 100644
--- a/MP.MONO.UI/Resources/ChangeLog.html
+++ b/MP.MONO.UI/Resources/ChangeLog.html
@@ -1,6 +1,6 @@