Chart.js如何在甜甜圈内的甜甜圈之间留出更多空间?

时间:2018-02-05 09:47:16

标签: javascript html css chart.js

有没有办法在圆环图中的圆环图之间留出更多空间? 目前它看起来像这样: enter image description here

我希望它看起来像这样:(甜甜圈之间的空间更大) enter image description here

1 个答案:

答案 0 :(得分:0)

此解决方案不再起作用:

Chart.js v2: space between doughnut inside doughnut

但是我发现另一个可以在之间添加空数据的方法

Padding Between Pie Charts in chart js

const colors = ["#FF6384", "#36A2EB", "#FFCE56"];
var pieChart = new Chart("myChart", {
   type: 'pie',
   data: {
     labels: ["Red", "Blue", "Yellow"],
     datasets: [{      
        data: [8, 5, 6],
      backgroundColor: colors,
  },{ 
  weight: 0.2
  },{ 
  data: [5, 7, 4],
  backgroundColor: colors,
  weight: 1.2
}]}})
相关问题