1
0
mirror of https://github.com/pcvolkmer/etl-processor.git synced 2025-07-03 15:02:56 +00:00

(Near) realtime update of statistics charts

This commit is contained in:
2023-07-25 20:55:32 +02:00
parent 94846deb98
commit 1a2d4ea7a2
7 changed files with 208 additions and 104 deletions

View File

@ -17,8 +17,18 @@
<script th:src="@{/echarts.min.js}"></script>
<script th:src="@{/scripts.js}"></script>
<script>
drawPieChart('statistics/requeststates', 'piechart', 'Statusverteilung der Anfragen');
drawBarChart('statistics/requestslastmonth', 'barchart', 'Anfragen des letzten Monats');
window.onload = () => {
drawPieChart('statistics/requeststates', 'piechart', 'Statusverteilung aller Anfragen');
drawBarChart('statistics/requestslastmonth', 'barchart', 'Anfragen der letzten 30 Tage');
const eventSource = new EventSource('statistics/events');
eventSource.addEventListener('requeststates', event => {
drawPieChart('statistics/requeststates', 'piechart', 'Statusverteilung aller Anfragen', JSON.parse(event.data));
});
eventSource.addEventListener('requestslastmonth', event => {
drawBarChart('statistics/requestslastmonth', 'barchart', 'Anfragen des letzten Monats', JSON.parse(event.data));
});
}
</script>
</body>
</html>