Added togglegraph function
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
@@ -191,5 +191,10 @@ body {
|
||||
display: flex;
|
||||
width: 20vw;
|
||||
z-index: -0;
|
||||
height: -;
|
||||
|
||||
}
|
||||
*
|
||||
.disabled {
|
||||
opacity: 0;
|
||||
height: 0;
|
||||
}
|
Reference in New Issue
Block a user