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