Update requirements and AGENTS instructions
This commit is contained in:
parent
e744276481
commit
d216433a07
6 changed files with 153 additions and 4 deletions
42
templates/report.html
Normal file
42
templates/report.html
Normal file
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{{ interval.title() }} Report</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
</head>
|
||||
<body class="section">
|
||||
<div class="container">
|
||||
<h1 class="title">{{ interval.title() }} Report</h1>
|
||||
<canvas id="chart"></canvas>
|
||||
</div>
|
||||
<script>
|
||||
fetch('{{ json_path }}')
|
||||
.then(r => r.json())
|
||||
.then(data => {
|
||||
const labels = data.map(x => x.bucket);
|
||||
const hits = data.map(x => x.hits);
|
||||
new Chart(document.getElementById('chart'), {
|
||||
type: '{{ 'bar' if interval == 'hourly' else 'line' }}',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: 'Hits',
|
||||
data: hits,
|
||||
backgroundColor: 'rgba(54, 162, 235, 0.5)',
|
||||
borderColor: 'rgba(54, 162, 235, 1)',
|
||||
borderWidth: 1,
|
||||
fill: true,
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
y: { beginAtZero: true }
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue