Added togglegraph function

This commit is contained in:
2024-03-30 17:22:55 +01:00
parent 92b27ab9b7
commit 3e7a89bf8b
2 changed files with 20 additions and 2 deletions

View File

@@ -103,7 +103,6 @@ async function nodeAdressHandler(node, dataTypes) {
sensorData[node] = gaugeGroup;
gaugeGroup.graph.makeGraph();
sensorData[node] = gaugeGroup;
}
}
@@ -129,3 +128,17 @@ function getNodeInfo(node){
}
// create a function to enable and disable the graph using .disabled using the id of the graph
function toggleGraph(nodeId) {
let graph = document.querySelector('#liveGraph' + nodeId);
if (graph) {
if (graph.classList.contains('disabled')) {
graph.classList.remove('disabled');
} else {
graph.classList.add('disabled');
}
} else {
console.error('No element found with id: liveGraph' + nodeId);
}
}

View File

@@ -191,5 +191,10 @@ body {
display: flex;
width: 20vw;
z-index: -0;
height: -;
}
*
.disabled {
opacity: 0;
height: 0;
}