我有这个 ChartJS donut 并添加了一个额外的标签,它将显示另一个值而不在 donut 上显示它。问题是,ChartJS 穿透了“隐藏”的标签。是否可以用颜色更改删除线?
这是我的图表:
这是源代码:
function donutChart(){
var ctx = document.getElementById('can');
var myChart = new Chart(ctx, {
type: 'doughnut',
data: {
labels: ['Red', 'Blue', 'Yellow', 'Misc'],
datasets: [{
label: '# of Votes',
data: [30, 10, 20],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(126, 214, 223, 0.2)',
'rgba(255, 206, 86, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(126, 214, 223, 1)',
'rgba(255, 206, 86, 1)'
],
borderWidth: 1
}]
},
options: {
legend : {
display: true,
position: 'bottom'
}
}
});
}
最佳答案
@jordanwillis 在类似问题上的回答解决了我的问题。 感谢@jordanwillis 和@uminder
关于javascript - 如何在 ChartJS donut 上用浅灰色更改标签删除线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59682880/