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

@ -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");
});
});