aktueller Graph endet am jeweiligen Tag

This commit is contained in:
hubobel 2026-06-24 15:55:08 +02:00
parent e5d8862ee7
commit 3724d971bd
2 changed files with 30 additions and 14 deletions

View file

@ -254,8 +254,10 @@ Hintergasse © 2026
<script>
const currentDay = {{ current_day }};
const history = {{ balance_history|tojson }};
console.log(history.current);
const currentPeriod = history.current || [];
const labels = currentPeriod.map(item => {
@ -273,7 +275,6 @@ const labels = currentPeriod.map(item => {
month = 11;
year--;
}
}
const startDate = new Date(
@ -287,18 +288,15 @@ const labels = currentPeriod.map(item => {
);
return startDate.toLocaleDateString(
"de-DE",
{
day: "2-digit",
month: "2-digit",
year: "numeric"
}
);
"de-DE",
{
day: "2-digit",
month: "2-digit"
}
);
});
function getSeries(periodName) {
const values = new Array(31).fill(null);
@ -313,6 +311,15 @@ function getSeries(periodName) {
});
if (periodName === "current") {
const lastDay = currentDay;
for (let i = lastDay; i < 31; i++) {
values[i] = null;
}
}
return values;
}
@ -387,7 +394,9 @@ new Chart(
pointRadius: 3,
pointHoverRadius: 8
pointHoverRadius: 8,
spanGaps: false
},
{
@ -475,7 +484,7 @@ new Chart(
x: {
title: {
display: true,
text: "Tag seit dem 15."
text: "Datum"
}
},