summaryrefslogtreecommitdiff
path: root/src/main/resources/templates/statistics.html
blob: 007303e1147e7005185aad266fc538935a557a23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html lang="de" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>ETL-Prozessor</title>
    <link rel="stylesheet" th:href="@{/style.css}" />
</head>
<body>
    <div th:replace="~{fragments.html :: nav}"></div>
    <main>
        <h1>Statistiken</h1>

        <div id="piechart" class="chart" style="width: 320px; height: 320px; display: inline-block"></div>
        <div id="barchart" class="chart" style="width: 720px; height: 320px; display: inline-block"></div>

    </main>
    <script th:src="@{/echarts.min.js}"></script>
    <script th:src="@{/scripts.js}"></script>
    <script>
        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>