Update API routes and sensor data functionality And API.ejs

This commit is contained in:
newtbot
2024-01-30 02:59:14 +08:00
parent 8836a3cfd4
commit 129ca202c0
10 changed files with 849 additions and 176 deletions

View File

@ -15,12 +15,11 @@ body {
}
.wrapper {
position: relative;
max-width: 470px;
max-width: 600px; /* Increase the maximum width */
width: 100%;
border-radius: 12px;
padding: 20px
30px
120px;
padding: 40px 50px 150px; /* Adjust the padding */
background: #4070f4;
box-shadow: 0
5px

View File

@ -1,5 +1,6 @@
//getting button from DOM id
const buttons = document.querySelectorAll(".button-container button");
const weeklybuttons = document.querySelectorAll(".weeklybutton-container button");
const queryButton = document.getElementById("querybutton-container");
$(document).ready(async function () {
@ -21,7 +22,7 @@ $(document).ready(async function () {
labels: [], // Array to store timestamps
datasets: [
{
label: "Average MeasurementData",
label: "Average Measurement Data",
data: [], // Array to store measurements objects
backgroundColor: "green",
borderColor: "green",
@ -87,7 +88,6 @@ $(document).ready(async function () {
chart.update();
});
}
// Event listeners for buttons
document.getElementById("psiButton").addEventListener("click", function () {
updateChart("psi");
@ -116,4 +116,6 @@ $(document).ready(async function () {
document.getElementById("coButton").addEventListener("click", function () {
updateChart("co");
});
});