UNPKG

rower-website

Version:

A web server which access the PM5 rowing machine over usb and displays the wattage value.

24 lines (18 loc) 825 B
// Generate a random number for the bar's height const randomHeight = Math.floor(Math.random() * 200); // Change 100 to your desired max height // Get the bar element const bar = document.getElementById('bar'); // Set the height based on the random number bar.style.height = `${randomHeight}%`; // Sample data (current, average, and peak values) const currentWattage = 50; const averageWattage = 75; const peakWattage = 100; // Function to update the bar chart function updateChart() { document.getElementById('current-bar').style.height = `${currentWattage}px`; document.getElementById('average-bar').style.height = `${averageWattage}px`; document.getElementById('peak-bar').style.height = `${peakWattage}px`; } // Call the updateChart function to initialize the chart updateChart();