Added graph

This commit is contained in:
2024-03-29 16:16:08 +01:00
parent 7a35c54322
commit 26b35036ec
3 changed files with 12 additions and 1 deletions

View File

@@ -24,8 +24,10 @@ class GaugeGroup {
</div> </div>
</div> </div>
`).join('')} `).join('')}
<div id="graph${nodeId}></div>
</div> </div>
<div class="plotly-container">
<div id="liveGraph${this.nodeId}" ></div>
</div>
`; `;
// Append the new div to the body // Append the new div to the body

View File

@@ -27,6 +27,7 @@
<body> <body>
<script src="https://cdn.plot.ly/plotly-latest.min.js" charset="utf-8"></script>
<script src="GaugGroup.js"></script> <script src="GaugGroup.js"></script>
<script src="main.js"></script> <script src="main.js"></script>
<script src="liveGraph.js"></script> <script src="liveGraph.js"></script>

View File

@@ -98,9 +98,17 @@ async function nodeAdressHandler(node, dataTypes) {
let gaugeGroup = new GaugeGroup(nodeName, nodeLocation, dataTypes.length, maxGaugeValues, dataTypes); let gaugeGroup = new GaugeGroup(nodeName, nodeLocation, dataTypes.length, maxGaugeValues, dataTypes);
sensorData[node] = gaugeGroup; sensorData[node] = gaugeGroup;
gaugeGroup.graph = new liveGraph(nodeName);
sensorData[node] = gaugeGroup;
gaugeGroup.graph.makeGraph();
sensorData[node] = gaugeGroup;
} }
} }
function getNodeInfo(node){ function getNodeInfo(node){
return fetch("http://145.92.8.114/getNodeInfo?macAdress=" + node) return fetch("http://145.92.8.114/getNodeInfo?macAdress=" + node)
.then(response => { .then(response => {