angular-chart.js甜甜圈图:如何更改甜甜圈弧的宽度?
问题描述:
我使用angular-chart.js库(https://jtblin.github.io/angular-chart.js/)来实现圆环图。angular-chart.js甜甜圈图:如何更改甜甜圈弧的宽度?
如何更改圆环的宽度?
答
您只需在图表选项中设置“cutoutPercentage”选项即可。圆环图的默认值是50.数字接近100会在中间有更多的空白空间,接近0的数字在圆环中间会有更少的空白空间。
在你的控制器:
$scope.options = {cutoutPercentage: 75};
$scope.data = [213, 546];
$scope.labels = ['Label 1', 'Label 2'];
在你HTML:
<canvas class="chart chart-doughnut" chart-data="data" chart-labels="labels" chart-options="options"> </canvas>
你检查chart.js之选择:http://www.chartjs.org/docs/#doughnut-pie-排行榜图表选项? – jtblin
此问题已被解答[这里](http://*.com/questions/21014123/how-to-vary-the-thickness-of-doughnut-chart-using-chartjs)。 – Ankur