fix pagina duration chart
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
@*<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Alarm Description</th>
|
||||
<th>Alarm Event Count</th>
|
||||
<th>Event Frequence</th>
|
||||
<th>Event Frequence Chart</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecordsFreq)
|
||||
{
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div>@record.AlarmDescription</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.EventCount</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
@if (totalVar != 0)
|
||||
{
|
||||
<span class="text-success">@calcPerc((double)record.EventCount)</span>
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="progress">
|
||||
<div class="progress-bar @styleColourPBar((double)record.EventCount/totalVar)" role="progressbar" style="@val((double)record.EventCount)" aria-valuemin="0" aria-valuemax="100">@record.EventCount</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
*@
|
||||
@@ -0,0 +1,79 @@
|
||||
//using Microsoft.AspNetCore.Components;
|
||||
//using MP.MONO.Data.DTO;
|
||||
//using MP.MONO.UI.Data;
|
||||
|
||||
//namespace MP.MONO.UI.Components
|
||||
//{
|
||||
// public partial class ListFreqAlarms
|
||||
// {
|
||||
// [Parameter]
|
||||
// public List<AlarmFreqDTO>? ListRecordsFreq { get; set; } = null;
|
||||
|
||||
// [Parameter]
|
||||
// public List<AlarmFreqDTO>? SearchRecordsFreq { get; set; } = null;
|
||||
|
||||
// [Parameter]
|
||||
// public int _currPage { get; set; } = 1;
|
||||
|
||||
// [Parameter]
|
||||
// public int _numRecord { get; set; } = 10;
|
||||
|
||||
// [Parameter]
|
||||
// public double totalVar { get; set; } = 0;
|
||||
|
||||
// protected DateTime _dtStart = DateTime.Now.AddHours(-24);
|
||||
// protected DateTime dtStart
|
||||
// {
|
||||
// get => _dtStart;
|
||||
// set
|
||||
// {
|
||||
// _dtStart = value;
|
||||
// var pUpd = Task.Run(async () =>
|
||||
// {
|
||||
// await ReloadData();
|
||||
// });
|
||||
// pUpd.Wait();
|
||||
// }
|
||||
// }
|
||||
// protected DateTime _dtEnd = DateTime.Now;
|
||||
// protected DateTime dtEnd
|
||||
// {
|
||||
// get => _dtEnd;
|
||||
// set
|
||||
// {
|
||||
// _dtEnd = value;
|
||||
// var pUpd = Task.Run(async () =>
|
||||
// {
|
||||
// await ReloadData();
|
||||
// });
|
||||
// pUpd.Wait();
|
||||
// }
|
||||
// }
|
||||
// private bool isLoading { get; set; } = false;
|
||||
// private async Task ReloadData()
|
||||
// {
|
||||
// isLoading = true;
|
||||
// DateTime adesso = DateTime.Now;
|
||||
// //SearchRecords = CurrentDataService.dbController.AlarmRecGetParetoFreq(1, adesso.AddHours(-numHourPrev), adesso);
|
||||
// if (setFreqDur)
|
||||
// {
|
||||
// SearchRecordsFreq = CurrentDataService.dbController.AlarmRecGetParetoFreq(1, dtStart, dtEnd);
|
||||
// ListRecordsFreq = SearchRecordsFreq.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
// totalCount = SearchRecordsFreq.Count;
|
||||
// totalVar = SearchRecordsFreq.Sum(x => x.EventCount);
|
||||
// calcolaSoglie();
|
||||
// await Task.Delay(1);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SearchRecordsDur = CurrentDataService.dbController.AlarmRecGetParetoDur(1, dtStart, dtEnd);
|
||||
// ListRecordsDur = SearchRecordsDur.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
// totalCount = SearchRecordsDur.Count;
|
||||
// totalVar = SearchRecordsDur.Sum(x => x.Duration);
|
||||
// await Task.Delay(1);
|
||||
// }
|
||||
// await Task.Delay(1);
|
||||
// isLoading = false;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Platforms>AnyCPU;x86;x64</Platforms>
|
||||
<Version>1.2.2209.2615</Version>
|
||||
<Version>1.2.2209.2617</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
<tr>
|
||||
<th>Alarm Description</th>
|
||||
<th>Alarm Event Count</th>
|
||||
<th>Event Frequence</th>
|
||||
<th>Event Frequence Chart</th>
|
||||
<th>Event Frequency</th>
|
||||
<th>Event Frequency Chart</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -73,13 +73,13 @@
|
||||
<div>
|
||||
@if (totalVar != 0)
|
||||
{
|
||||
<span class="text-success">@calcPerc((double)record.EventCount)</span>
|
||||
<span class="text-success">@calcPercFreq((double)record.EventCount)</span>
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="progress">
|
||||
<div class="progress-bar @styleColourPBar((double)record.EventCount/totalVar)" role="progressbar" style="@val((double)record.EventCount)" aria-valuemin="0" aria-valuemax="100">@record.EventCount</div>
|
||||
<div class="progress-bar @styleColourPBarFreq((double)record.EventCount/totalVar)" role="progressbar" style="@valFreq((double)record.EventCount)" aria-valuemin="0" aria-valuemax="100">@record.EventCount</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -98,8 +98,8 @@
|
||||
<tr>
|
||||
<th>Alarm Description</th>
|
||||
<th>Alarm Duration</th>
|
||||
@*<th>Event Frequence</th>
|
||||
<th>Event Frequence Chart</th>*@
|
||||
<th>Event Duration</th>
|
||||
<th>Event Duration Chart</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -111,21 +111,21 @@
|
||||
<div>@item.AlarmDescription</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@item.Duration</div>
|
||||
<div>@Math.Round(item.Duration,2)</div>
|
||||
</td>
|
||||
@*<td>
|
||||
<td>
|
||||
<div>
|
||||
@if (totalEvents != 0)
|
||||
@if (totalVar != 0)
|
||||
{
|
||||
<span class="text-success">@calcPerc((double)record.EventCount)</span>
|
||||
<span class="text-success">@calcPercDur((double)item.Duration)</span>
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="progress">
|
||||
<div class="progress-bar @styleColourPBar((double)record.EventCount/totalEvents)" role="progressbar" style="@val((double)record.EventCount)" aria-valuemin="0" aria-valuemax="100">@record.EventCount</div>
|
||||
</div>
|
||||
</td>*@
|
||||
<div class="progress-bar @styleColourPBarDur((double)item.Duration/totalVar)" role="progressbar" style="@valDur((double)item.Duration)" aria-valuemin="0" aria-valuemax="100">@Math.Round(item.Duration,2)</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>MAPO-MONO</i>
|
||||
<h4>Version: 1.2.2209.2615</h4>
|
||||
<h4>Version: 1.2.2209.2617</h4>
|
||||
<br /> Release Note:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.2.2209.2615
|
||||
1.2.2209.2617
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.2.2209.2615</version>
|
||||
<version>1.2.2209.2617</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user