diff --git a/Lux.UI/Components/Compo/Stats/RealTimeStats.razor.cs b/Lux.UI/Components/Compo/Stats/RealTimeStats.razor.cs
index 3a86e8ec..6f41e730 100644
--- a/Lux.UI/Components/Compo/Stats/RealTimeStats.razor.cs
+++ b/Lux.UI/Components/Compo/Stats/RealTimeStats.razor.cs
@@ -37,9 +37,6 @@ namespace Lux.UI.Components.Compo.Stats
{
if (firstRender)
{
-#if false
- InitConfig();
-#endif
await InitCharts();
_cts = new CancellationTokenSource();
_ = UpdateLoop(_cts.Token);
@@ -140,37 +137,17 @@ namespace Lux.UI.Components.Compo.Stats
{
PieColors.Clear();
PieColors.Add("WINDOW", "rgba(54,162,235,0.6)");
- PieColors.Add("BEAM", "rgba(255,99,132,0.6)");
-#if false
- Labels.Clear();
- Labels.Add("WINDOW");
- Labels.Add("BEAM");
-
-
- PieCount.Clear();
- PieCount.Add("WINDOW", 208);
- PieCount.Add("BEAM", 13);
-
- ListX.Clear();
- ListX = new List
{ "2025-12-17T00:00:00" };
-
- DictY.Clear();
- DictY.Add("WINDOW", new List { 208, 150 });
- DictY.Add("BEAM", new List { 13, 20 });
-#endif
- PieCount.Clear();
- PieCount.Add("NONE", 0);
- PieElapsed.Clear();
- PieElapsed.Add("NONE", 0);
+ PieColors.Add("BEAM", "rgba(69,195,132,0.6)");
+ DatasetCount.Clear();
+ DatasetCount.Add("NONE", 0);
+ DataseElapsed.Clear();
+ DataseElapsed.Add("NONE", 0);
}
private Dictionary PieColors = new Dictionary();
- private Dictionary PieCount = new Dictionary();
- private Dictionary PieElapsed = new Dictionary();
-#if false
- private List Labels = new List();
-#endif
+ private Dictionary DatasetCount = new Dictionary();
+ private Dictionary DataseElapsed = new Dictionary();
private List ListX = new List();
private Dictionary> DictY = new Dictionary>();
@@ -220,27 +197,45 @@ namespace Lux.UI.Components.Compo.Stats
// calcolo i valori da mostrare...
if (rtProcStats != null && rtProcStats.Count > 0)
{
-#if false
- PieCount.Clear();
- PieElapsed.Clear();
- await InvokeAsync(StateHasChanged);
-#endif
-
- PieCount = rtProcStats
+ DatasetCount = rtProcStats
.GroupBy(p => p.TagClass)
.ToDictionary(
g => g.Key,
g => (double)g.Sum(p => p.EventCount)
);
- PieElapsed = rtProcStats
+ DataseElapsed = rtProcStats
.GroupBy(p => p.TagClass)
.ToDictionary(
g => g.Key,
g => g.Sum(p => p.Elapsed)
);
+
+ // 1. Definiamo le etichette dell'asse X (es. le ultime 24 ore o quelle presenti nei dati)
+ ListX = rtProcStats
+ .Select(p => p.Hour.ToString("HH:mm"))
+ .Distinct()
+ .OrderBy(t => t)
+ .ToList();
+
+ // 2. Identifichiamo tutti i TagClass unici (saranno i nostri dataset)
+ var allTags = rtProcStats.Select(p => p.TagClass).Distinct().ToList();
+
+ // 3. Costruiamo il DictY: per ogni Tag, creiamo una lista di valori allineata a ListX
+ DictY = allTags.ToDictionary(
+ tag => tag,
+ tag => ListX.Select(hour =>
+ {
+ // Cerchiamo il valore per quel tag in quell'ora specifica
+ return (decimal)(rtProcStats
+ .FirstOrDefault(p => p.TagClass == tag && p.Hour.ToString("HH:mm") == hour)
+ ?.EventCount ?? 0); // Se non esiste, mettiamo 0
+ }).ToList()
+ );
+
+ // forzatura update
await InvokeAsync(StateHasChanged);
}
}
diff --git a/Lux.UI/wwwroot/lib/js/chartsInterop.js b/Lux.UI/wwwroot/lib/js/chartsInterop.js
index 822f4d3e..cdec61d7 100644
--- a/Lux.UI/wwwroot/lib/js/chartsInterop.js
+++ b/Lux.UI/wwwroot/lib/js/chartsInterop.js
@@ -76,20 +76,31 @@
}
},
-
- createBarChart: function (canvasId, labels, datasets) {
- const ctx = document.getElementById(canvasId);
- new Chart(ctx, {
- type: "bar",
- data: { labels: labels, datasets: datasets },
- options: {
- responsive: true,
- plugins: { legend: { position: "top" } },
- scales: {
- x: { stacked: true, title: { display: true, text: "X Axis" } },
- y: { stacked: true, title: { display: true, text: "Values" } }
- }
- }
- });
+ createBarChart: function (canvasId, config) {
+ if (this.charts[canvasId]) {
+ const chart = this.charts[canvasId];
+ chart.data.labels = config.data.labels;
+ chart.data.datasets = config.data.datasets; // Sostituisce i dataset con i nuovi
+ chart.update('none'); // Update senza animazione per aggiornamenti real-time
+ } else {
+ const ctx = document.getElementById(canvasId).getContext('2d');
+ this.charts[canvasId] = new Chart(ctx, config);
+ }
}
+
+ //createBarChart: function (canvasId, labels, datasets) {
+ // const ctx = document.getElementById(canvasId);
+ // new Chart(ctx, {
+ // type: "bar",
+ // data: { labels: labels, datasets: datasets },
+ // options: {
+ // responsive: true,
+ // plugins: { legend: { position: "top" } },
+ // scales: {
+ // x: { stacked: true, title: { display: true, text: "X Axis" } },
+ // y: { stacked: true, title: { display: true, text: "Values" } }
+ // }
+ // }
+ // });
+ //}
};
diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html
index 623ba636..63a1c685 100644
--- a/Resources/ChangeLog.html
+++ b/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
LUX - Web Windows MES
- Versione: 0.9.2512.1812
+ Versione: 0.9.2512.1815
Note di rilascio:
-
diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt
index e99e64e3..1d5d1ca1 100644
--- a/Resources/VersNum.txt
+++ b/Resources/VersNum.txt
@@ -1 +1 @@
-0.9.2512.1812
+0.9.2512.1815
diff --git a/Resources/manifest.xml b/Resources/manifest.xml
index a0814553..f7c50c5f 100644
--- a/Resources/manifest.xml
+++ b/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 0.9.2512.1812
+ 0.9.2512.1815
http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip
http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html
false