📜  带有反应显示百分比的甜甜圈图表 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:27.941000             🧑  作者: Mango

代码示例1
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
        }
      },
    }
});