升级到ChartJS 2.7或更高版本后,我的甜甜圈图的尺寸看起来变得不均匀。
这就是ChartJS 2.7或更高版本现在的样子...
这是此图表的脚本:
var pieOpt = {
responsive: true,
tooltips: {
mode: 'index',
intersect: false,
callbacks: {
label: function(tooltipItems, data) {
return data.labels[tooltipItems.index] +': '+ formatCurrency( data.datasets[0].data[tooltipItems.index] );
}
}
},
hover: {
mode: 'nearest',
intersect: true
},
legend: {
position:'bottom'
},
animation: {
animateScale: true,
animateRotate: true
}
};
var config2 = {
type: 'doughnut',
data: {
datasets: [{
backgroundColor: [
window.chartColors.green,
window.chartColors.red,
window.chartColors.yellow
],
label: 'Dataset 1'
}],
labels: [
"Remaining Fund",
"Labor Cost",
"Material"
]
},
options: pieOpt
};
我唯一改变的是升级ChartJS的版本。有谁知道为什么我会看到这个?