class GaugeGroup { constructor(nodeId, gaugesCount) { this.nodeId = nodeId; this.gaugesCount = gaugesCount; this.maxGaugeValue = 100; // Maximum value the gauge can display // Create a new div element this.element = document.createElement("div"); this.element.className = "gaugeGroup"; // Set the HTML of the new div this.element.innerHTML = `

Gauge Group for Node ${this.nodeId}

${Array(this.gaugesCount).fill().map((_, i) => `
0
`).join('')}
`; // Append the new div to the body document.body.appendChild(this.element); } updateGauge(gaugeId, value) { const needle = document.getElementById(`needle${this.nodeId}_${gaugeId}`); const gaugeText = document.getElementById(`gaugeText${this.nodeId}_${gaugeId}`); const rotationDegree = ((value / this.maxGaugeValue) * 180) - 90; // Convert value to degree (-90 to 90) needle.style.transform = `rotate(${rotationDegree}deg)`; gaugeText.textContent = value; // Update the text } }