poprawki, zmian w logice eventow, poprawka w zapytaniach, wykres live, lepsza stopla, uzunięcie eventlet

This commit is contained in:
Mateusz Gruszczyński
2026-03-01 23:24:54 +01:00
parent 7429cb5660
commit f0862c12eb
5 changed files with 111 additions and 45 deletions

View File

@@ -4,6 +4,7 @@ let phasesConfig = {};
const gauges = {};
let voltageChart = null;
const THRESHOLDS = { min: 207, max: 253 };
let disableChartAnimationOnce = false;
/**
* Inicjalizacja monitora
@@ -31,6 +32,13 @@ function initMonitor(phases, defaultRange) {
}
});
socket.on('refresh_timeseries', async () => {
if (currentTimeRange === 'precise') return;
disableChartAnimationOnce = true;
await reloadDataForRange(null, null, currentTimeRange);
});
window.changeTimeRange(currentTimeRange);
}
@@ -200,16 +208,18 @@ async function reloadDataForRange(min, max, rangeName = null) {
}
voltageChart.data.datasets = newDatasets;
if (rangeName) {
voltageChart.update();
if (disableChartAnimationOnce) {
voltageChart.update('none');
disableChartAnimationOnce = false;
} else {
voltageChart.update('none');
if (rangeName) voltageChart.update();
else voltageChart.update('none');
}
const finalMin = rangeName ? voltageChart.scales.x.min : (min || voltageChart.scales.x.min);
const finalMax = rangeName ? voltageChart.scales.x.max : (max || voltageChart.scales.x.max);
updateRangeLabel(finalMin, finalMax);
}
const finalMin = rangeName ? voltageChart.scales.x.min : (min || voltageChart.scales.x.min);
const finalMax = rangeName ? voltageChart.scales.x.max : (max || voltageChart.scales.x.max);
updateRangeLabel(finalMin, finalMax);
}
/**