mirror of
https://github.com/FliegendeWurst/sensor-dashboard.git
synced 2024-09-07 21:21:51 +00:00
12 hours button
This commit is contained in:
parent
baa2f0eea4
commit
1030cba4a0
6
base.js
6
base.js
@ -19,6 +19,10 @@ function buttonsPlugin(opts) {
|
||||
});
|
||||
}
|
||||
|
||||
const day12 = document.getElementById("h12");
|
||||
day12.addEventListener("click", e => {
|
||||
zoomRange(60 * 60 * 12);
|
||||
});
|
||||
const day = document.getElementById("day");
|
||||
day.addEventListener("click", e => {
|
||||
zoomRange(60 * 60 * 24);
|
||||
@ -59,7 +63,7 @@ function processCSV() {
|
||||
x: {
|
||||
time: true,
|
||||
range: (u, dataMin, dataMax) => {
|
||||
if ((dataMax - dataMin) % (60 * 60 * 24) === 0) {
|
||||
if ((dataMax - dataMin) % (60 * 60 * 12) === 0) {
|
||||
return [dataMin, dataMax];
|
||||
} else {
|
||||
return [dataMin, Math.ceil(dataMax / (24 * 60 * 60)) * 24 * 60 * 60];
|
||||
|
@ -20,8 +20,8 @@
|
||||
align-items: center;
|
||||
}
|
||||
button {
|
||||
padding: 0.5em;
|
||||
margin: 0.75em;
|
||||
padding: 0.4em;
|
||||
margin: 0.65em;
|
||||
font-size: x-large;
|
||||
}
|
||||
</style>
|
||||
@ -29,6 +29,7 @@
|
||||
<body>
|
||||
<div id="plot"></div>
|
||||
<div id="buttons" style="display: none">
|
||||
<button id="h12">12 hours</button>
|
||||
<button id="day">24 hours</button>
|
||||
<button id="week">7 days</button>
|
||||
<button id="all">all data</button>
|
||||
|
Loading…
Reference in New Issue
Block a user