generator-status/stats.html

130 lines
4.0 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="manifest" href="/manifest.json">
<script type="module">
import 'https://cdn.jsdelivr.net/npm/@pwabuilder/pwaupdate';
const el = document.createElement('pwa-update');
document.body.appendChild(el);
</script>
<title>Generator Status...</title>
<style>
* {
margin: 0;
}
p {
font-family: "Source Sans Pro", "SF Pro Display", sans-serif;
font-weight: 600;
font-size: inherit;
}
b {
font-weight: bolder;
}
.title-bg {
background-color: dimgray;
height: auto;
display: block;
text-align: center;
align-content: center;
padding: 50px 50px 10px 50px;
}
.title-text {
color: white;
padding: 10px 5px;
font-size: 40px;
}
.credits {
padding: 10px 5px;
text-align: center;
font-size: 15px;
color: gray;
}
.credits a {
color: #555555;
font-weight: 700;
}
.credits a:hover {
color: #3c5c68;
}
a {
text-decoration: none;
color: inherit;
}
.date-time-updated {
padding: 5px 5px;
color: #dddddd;
text-align: center;
}
.date-time-updated b {
color: #ffffff;
}
</style>
</head>
<body>
<div class="title-bg">
<div class="title-text">
<p>Generator Stats</p>
</div>
<div class="date-time-updated">
<p>last updated on: <b>date-n-time-placeholder</b></p>
</div>
</div>
<div class="chart_last_week_class">
<canvas id="chart_last_week"></canvas>
</div>
<div class="credits">
<p>Made with ❤️ | Source Code: <a href="https://git.sandcastle.eu.org/thebiblelover7/generator-status">Gitea</a>
<br>
Thanks to <a href="https://matrix.to/#/@junyong_chung:tchncs.de">Junyong Chung</a> for the hardware and <a href="https://meu.edu.lb">MEU</a> for providing the domain.</p>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
const labels = [
'day_date_1',
'day_date_2',
'day_date_3',
'day_date_4',
'day_date_5',
'day_date_6',
'day_date_7',
];
const data = {
labels: labels,
datasets: [
{
label: 'Hours we had electricity from government',
backgroundColor: 'rgb(255, 99, 132)',
borderColor: 'rgb(255, 99, 132)',
data: [offtime_1, offtime_2, offtime_3, offtime_4, offtime_5, offtime_6, offtime_7],
fill: true,
// fill: {
// target: 'origin',
// above: 'rgb(255, 0, 0)', // Area will be red above the origin
// below: 'rgb(0, 0, 255)' // And blue below the origin
//
// },
},
]
};
const config = {
type: 'line',
data: data,
options: {
scales: {
y: {
beginAtZero: true,
max: 24,
}
}
}
};
var chart_last_week = new Chart(
document.getElementById('chart_last_week'),
config
);
</script>
</html>