Doughnut Chart

What is a Doughnut Chart ?

  • Profile picture of Mcs
  • by Mcs July 1, 2025

A Doughnut Chart is just like a Pie Chart, but with a hole in the center. It shows proportions of data as slices of a ring — useful for comparing parts of a whole (100%).

Key Features:

  1. Circular like pie chart, but with a center hole
  2. You can place text or icons in the center (optional)
  3. Useful for showing relative percentages or breakdowns

 Doughnut Chart Example 

<canvas id="myDoughnutChart" width="300" height="300"></canvas>

<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
 const ctx = document.getElementById('myDoughnutChart').getContext('2d');

 const myDoughnutChart = new Chart(ctx, {
   type: 'doughnut',
   data: {
     labels: ['Facebook', 'Instagram', 'Twitter'],
     datasets: [{
       label: 'Social Media Usage',
       data: [50, 30, 20],
       backgroundColor: ['#3b5998', '#e1306c', '#1da1f2']
     }]
   },
   options: {
     responsive: true,
     cutout: '50%', // Controls hole size
   }
 });
</script>

Comments

Add new comment

Restricted HTML

  • Allowed HTML tags: <br> <p> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <cite> <dl> <dt> <dd> <a hreflang href> <blockquote cite> <ul type> <ol type start> <strong> <em> <code> <li>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.