我正在使用 Chart.js,我想删除下图中标有红色圆圈的百分比标签。
我正在使用此代码生成此图表:
const options = {
responsive: true,
title: {
display: false
},
legend: {
display: false
},
tooltips: {
mode: 'index',
intersect: true
},
scales: {
yAxes: [{
type: 'linear',
position: 'left',
id: 'y-axis-1'
}, {
type: 'linear',
position: 'right',
id: 'y-axis-2',
gridLines: {
drawOnChartArea: false
}
}],
}
};
new Chart(document.getElementById('originalThirdChart').getContext('2d'), {
type: 'bar',
data: data,
options: options
});
我怎样才能做到这一点?提前致谢!
最佳答案
如果您只想删除百分比,只需在选项中添加此行
labels: { render: () => {} }
它看起来像:options: {
plugins: {
labels: {
render: () => {}
}
}
}
关于javascript - Chart.js - 如何删除百分比数据标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53013400/