Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

doughnut chartjs with react display percentage

var canvas = document.getElementById('myChart');
new Chart(canvas, {
    type: 'Doughnut',    
    data: {
      labels: ['January', 'February', 'March'],
      datasets: [{
        data: [50445, 33655, 15900],
        backgroundColor: ['#FF6384', '#36A2EB','#FFCE56']
      }]
    },
    options: {
      responsive: true,
      maintainAspectRatio: true,
      plugins: {
        labels: {
          render: 'percentage',
          fontColor: ['green', 'white', 'red'],
          precision: 2
        }
      },
    }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #doughnut #chartjs #react #display #percentage
ADD COMMENT
Topic
Name
8+3 =