使用Chart js

时间:2017-05-31 10:56:31

标签: label chart.js legend pie-chart styling

如何将图例类型从矩形框设置为圆形? 饼图使用chartjs.org enter image description here

2 个答案:

答案 0 :(得分:2)

您可以通过为图表选项中的图例标签设置usePointStyle属性为true来完成此操作,就像这样......

options: {
   legend: {
      labels: {
         usePointStyle: true  //<-- set this
      }
   },
   ...
}

答案 1 :(得分:0)

像这样输入数据集:

datasets: [{
    data: [10, 20, 30],
    backgroundColor: [
       'red',
       'orange',
       'blue'
    ],
}]
相关问题