diff --git a/data/www/index.html b/data/www/index.html index ffb3ceb..236142d 100644 --- a/data/www/index.html +++ b/data/www/index.html @@ -1 +1 @@ - Bojler

🌡️ bojler

Aktuální teplota
-- °C

Stav ventilu

❓ Neznámý

⚙️ Nastavení
📈 Historie teploty
📋 Záznam událostí
Načítám události...
\ No newline at end of file + Bojler

🌡️ bojler

Aktuální teplota
-- °C

Stav ventilu

❓ Neznámý

⚙️ Nastavení
📈 Historie teploty
📋 Záznam událostí
Načítám události...
\ No newline at end of file diff --git a/res/index.html b/res/index.html index fe6b46c..af1a712 100644 --- a/res/index.html +++ b/res/index.html @@ -150,15 +150,22 @@
-
+
📈 Historie teploty
- +
+ + +
@@ -210,7 +217,7 @@ } if (currentChartData.data.length > 0) { - updateChart(currentChartData.data, currentChartData.hours); + updateChart(currentChartData.data); } } @@ -221,6 +228,20 @@ applyTheme(currentTheme); // --------------------------------------- + // --- Správa rozsahu osy Y --- + const yAxisRangeSelect = document.getElementById('y-axis-range'); + let currentYAxisRange = localStorage.getItem('graphRange') || '0-100'; + yAxisRangeSelect.value = currentYAxisRange; + + yAxisRangeSelect.addEventListener('change', (e) => { + currentYAxisRange = e.target.value; + localStorage.setItem('graphRange', currentYAxisRange); + if (currentChartData.data.length > 0) { + updateChart(currentChartData.data); + } + }); + // --------------------------------------- + function showNotification(message, isError = false) { const notif = document.getElementById('notification'); notif.className = `alert rounded-pill px-4 shadow-lg ${isError ? 'alert-danger' : 'alert-success'}`; @@ -346,6 +367,17 @@ chartInstance.destroy(); } + // Rozhodnutí o min/max pro osu Y na základě vybrané volby + let yMin = 0; + let yMax = 100; + if (currentYAxisRange === '10-80') { + yMin = 10; + yMax = 80; + } else if (currentYAxisRange === 'auto') { + yMin = undefined; + yMax = undefined; + } + chartInstance = new Chart(ctx, { type: 'line', data: { @@ -379,8 +411,8 @@ title: { display: true, text: 'Teplota (°C)', color: textColor }, ticks: { color: textColor }, grid: { color: gridColor, drawBorder: false }, - min: 0, - max: 100 + min: yMin, + max: yMax } }, plugins: {