top of page
bottom of page
// Function to render the circular progress chart function renderProgressChart(percentage) { const ctx = document.getElementById('progressChart').getContext('2d'); // Calculate remaining percentage for donut chart const remainingPercentage = 100 - percentage; // Create the chart new Chart(ctx, { type: 'doughnut', data: { datasets: [{ data: [percentage, remainingPercentage], backgroundColor: ['#00FF00', '#e0e0e0'], // Lime green for progress, light gray for remaining borderWidth: 0 }] }, options: { plugins: { legend: { display: false // Hide legend } }, cutout: '75%', // Creates the donut shape (hollow center) rotation: -90, // Starts the progress from the top circumference: 360 // Adjust for full circle } }); } // Example usage, replace 75 with your actual percentage renderProgressChart(75);