问题描述
我想从我得到的数据中显示我的图表上的所有点,但我不想显示它们的所有标签,因为那时图表不是很易读。我在文档中寻找它,但找不到任何限制此参数的参数。
I want to display all of the points on my chart from the data I get, but I don't want to display all the labels for them, because then the chart is not very readable. I was looking for it in the docs, but couldn't find any parameter that would limit this.
我不想只拿三个标签,例如,因为那么图表也限于三个点。有可能吗?
I don't want to take only three labels for example, because then the chart is also limited to three points. Is it possible?
我现在有类似的东西:
如果我可以留下每个第三个第四个标签,那就太棒了。但我发现标签选项一无所获。
If I could just leave every third-fourth label, it would be great. But I found absolutely nothing about labels options.
推荐答案
尝试添加选项:
Try adding the options.scales.xAxes.ticks.maxTicksLimit
option:
xAxes: [{
type: 'time',
ticks: {
autoSkip: true,
maxTicksLimit: 20
}
}]
这篇关于限制Chart.js折线图上的标签编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!