Aggiunta gestione icona + bar % valore

This commit is contained in:
Samuele Locatelli
2022-03-08 15:40:33 +01:00
parent 198e5fa5a5
commit b1d0b02fd8
3 changed files with 20 additions and 3 deletions
+10 -2
View File
@@ -22,8 +22,16 @@
{
<div>@item.Title</div>
}
<div>
<h5> <b>@item.Value</b></h5>
<div class="d-flex flex-column">
<div><h5><b>@item.Value</b></h5></div>
@if (item.ShowBar)
{
<div class="w-100">
<div class="progress" style="height: 0.3rem;">
<div class="progress-bar" role="progressbar" style="@percProgress(item.ValueNum, item.MinVal, item.MaxVal)" aria-valuenow="@item.ValueNum" aria-valuemin="@item.MinVal" aria-valuemax="@item.MaxVal"></div>
</div>
</div>
}
</div>
</div>
</li>
@@ -47,6 +47,15 @@ namespace MP.MONO.UI.Components
ListRecords = await MMDataService.MachineParameters();
}
protected string percProgress(double num, double minVal, double maxVal)
{
string answ = "width: 0%;";
double den = (maxVal - minVal) != 0 ? (maxVal - minVal) : 1;
double ratio = ((double)num) / den;
answ = $"width: {ratio:P0};";
return answ;
}
#endregion Protected Methods
}
}
+1 -1
View File
@@ -45,7 +45,7 @@
"DisplFormat": "N1",
"IsNumeric": true,
"EnablePlot": true,
"ShowGauge": true,
"ShowBar": true,
"CssIcon": "fa-solid fa-bolt"
},
{