diff --git a/server/frontend/public/assets/js/main.js b/server/frontend/public/assets/js/main.js
index 92247f6..24e9537 100644
--- a/server/frontend/public/assets/js/main.js
+++ b/server/frontend/public/assets/js/main.js
@@ -28,4 +28,25 @@ async function loadData() {
chart.destroy();
}
chart = renderChart(points);
+ updateKPIs(points);
+}
+
+function updateKPIs(points) {
+ const totalDisplay = document.getElementById("kpi-total");
+ const avgDisplay = document.getElementById("kpi-avg");
+ const countDisplay = document.getElementById("kpi-count");
+
+ if (!points || points.length === 0) {
+ total.textContent = "-";
+ avg.textContent = "-";
+ count.textContent = "-";
+ return;
+ }
+
+ const totalValue = points.reduce((acc, p) => acc + p.delta_m3, 0);
+ const avgValue = totalValue / points.length;
+
+ totalDisplay.textContent = totalValue.toFixed(3);
+ avgDisplay.textContent = avgValue.toFixed(3);
+ countDisplay.textContent = points.length;
}
diff --git a/server/frontend/public/index.html b/server/frontend/public/index.html
index 35f3f3a..e8fb122 100644
--- a/server/frontend/public/index.html
+++ b/server/frontend/public/index.html
@@ -32,6 +32,31 @@
+
+
+
+ - Consommation totale
+ -
+ -
+ m³
+
+
+
+ - Moyenne par période
+ -
+ -
+ m³
+
+
+
+ - Relevés
+ -
+ -
+ points
+
+
+
+