Javascript examples for Chart.js:Doughnut Chart
Chart.js to create Multiple Doughnut Charts
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.js"></script> <script type="text/javascript"> window.onload=function(){// w w w . j a v a2 s .c o m var ctx = $("#myChart"); var myChart = new Chart(ctx, { type: 'doughnut', data: { labels: ["Green", "Yellow", "Red", "Purple", "Blue"], datasets: [{ data: [1, 2, 3, 4, 5], backgroundColor: [ 'green', 'yellow', 'red', 'purple', 'blue', ], labels: [ 'green', 'yellow', 'red', 'purple', 'blue', ] }, { data: [6, 7, 8], backgroundColor: [ 'black', 'grey', 'lightgrey' ], labels: [ 'black', 'grey', 'lightgrey' ], }, ] }, options: { responsive: true, legend: { display: false, }, tooltips: { callbacks: { label: function(tooltipItem, data) { var dataset = data.datasets[tooltipItem.datasetIndex]; var index = tooltipItem.index; return dataset.labels[index] + ': ' + dataset.data[index]; } } } } }); } </script> </head> <body> <canvas id="myChart"></canvas> </body> </html>