diff --git a/web/new website/gauge.js b/web/new website/gauge.js index 5319b5c..5a6e9cc 100644 --- a/web/new website/gauge.js +++ b/web/new website/gauge.js @@ -1,22 +1,9 @@ -// JavaScript -function updateGauge(value) { - const gaugeValue = document.getElementById('gaugeValue'); - const gaugeText = document.getElementById('gaugeText'); +function updateGauge(gaugeId, value) { + const needle = document.getElementById(`needle${gaugeId}`); + const gaugeText = document.getElementById(`gaugeText${gaugeId}`); const maxGaugeValue = 100; // Maximum value the gauge can display const rotationDegree = ((value / maxGaugeValue) * 180) - 90; // Convert value to degree (-90 to 90) - gaugeValue.style.transform = `rotate(${rotationDegree}deg)`; + needle.style.transform = `rotate(${rotationDegree}deg)`; gaugeText.textContent = value; // Update the text - - // Change color based on value - if (value <= 40) { - gaugeValue.style.backgroundColor = 'green'; - } else if (value <= 80) { - gaugeValue.style.backgroundColor = 'orange'; - } else { - gaugeValue.style.backgroundColor = 'red'; - } -} - -// Example usage: -updateGauge(50); // Rotates the gauge to 0 degrees (50 out of 100), changes color to orange, and updates the text to "50" \ No newline at end of file +} \ No newline at end of file diff --git a/web/new website/index.html b/web/new website/index.html index e323269..e90a2df 100644 --- a/web/new website/index.html +++ b/web/new website/index.html @@ -5,56 +5,56 @@ -