Graph hinzugefügt

This commit is contained in:
hubobel 2026-06-23 17:49:52 +02:00
parent b8897ce67c
commit 2f4fa79027
2 changed files with 113 additions and 7 deletions

View file

@ -15,6 +15,8 @@
href="{{ url_for('static', filename='style.css') }}">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
@ -112,7 +114,15 @@
</p>
</div>
<div class="card">
<h2>
Kontostand letzte 30 Tage
</h2>
<canvas id="balanceChart"></canvas>
</div>
<div class="card">
<h2>
@ -242,6 +252,49 @@ Hintergasse © 2026
</div>
<script>
const history = {{ balance_history|tojson }};
const labels = history.map(item => item.date);
const values = history.map(item => item.value);
new Chart(
document.getElementById("balanceChart"),
{
type: "line",
data: {
labels: labels,
datasets: [{
label: "Kontostand (€)",
data: values,
tension: 0.3
}]
},
options: {
responsive: true,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: false
}
}
}
}
);
</script>
</body>
</html>