added script to output stats to a file, fixed wrong time zone on light_cuts.csv
This commit is contained in:
119
stats.html
Normal file
119
stats.html
Normal file
@@ -0,0 +1,119 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<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 at: <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 = [
|
||||
'Sunday',
|
||||
'Monday',
|
||||
'Tuesday',
|
||||
'Wednesday',
|
||||
'Thursday',
|
||||
'Friday',
|
||||
'Saturday',
|
||||
];
|
||||
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: {
|
||||
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>
|
Reference in New Issue
Block a user