fixed updating charts with selected time range
This commit is contained in:
@@ -345,13 +345,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document
|
function attachTimeRangeListener() {
|
||||||
.getElementById("timeRangeFilter")
|
const timeRangeFilter = document.getElementById("timeRangeFilter");
|
||||||
.addEventListener("change", function () {
|
if (timeRangeFilter) {
|
||||||
|
timeRangeFilter.addEventListener("change", function () {
|
||||||
// Save selection to localStorage
|
// Save selection to localStorage
|
||||||
localStorage.setItem("lastSleepTimeRange", this.value);
|
localStorage.setItem("lastSleepTimeRange", this.value);
|
||||||
loadData();
|
renderCharts();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function loadData() {
|
async function loadData() {
|
||||||
try {
|
try {
|
||||||
@@ -443,6 +446,9 @@
|
|||||||
attachChildFilterListener();
|
attachChildFilterListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always attach time range listener after recreating the controls
|
||||||
|
attachTimeRangeListener();
|
||||||
|
|
||||||
renderCharts();
|
renderCharts();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error loading data:", error);
|
console.error("Error loading data:", error);
|
||||||
|
|||||||
Reference in New Issue
Block a user