显示Chart.js中的所有标签 [英] Display all labels in Chart.js
本文介绍了显示Chart.js中的所有标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对CHART.JS的图形有问题,当我将时间间隔设为2年时,月份的某些标签会重叠。我希望所有标签都出现,时间间隔无关紧要。
I have a problem with the graphics of CHART.JS, and when I put the time interval of 2 years, some labels of the months overlap. And I want all the labels to appear, the time interval doesn't matter.
var g = new Chart(ctx, {
type: 'bar',
data: {
labels: labelsHeader,
datasets: listData,
},
options:{
maintainAspectRatio: false,
}
});
推荐答案
在选项下添加以下内容:
Add the following under options:
options: {
scaleShowValues: true,
scales: {
xAxes: [{
ticks: {
autoSkip: false
}
}]
}
}
这篇关于显示Chart.js中的所有标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文