如何像示例图片一样更改条形图的背景和宽度。
答案 0 :(得分:0)
尝试一下
this.myChart = new Chart(ctx, {
type: 'bar',
data: {
datasets: [{
backgroundColor: [
'rgba(0,128,0,0.2)',
'rgba(0,0,0,0)'
],
}]
},
options: {
scales: {
yAxes: [{
barPercentage: 0.5,
barThickness: 6,
maxBarThickness: 8,
minBarLength: 2
}]
}
}
});