英文:
Allowing X-axis labelOverlap on a column chart in HighCharts..?
问题
我正在尝试在HighCharts的柱形图中允许X轴标签重叠,但似乎不起作用。在API中,似乎应该按以下方式完成:
xAxis: {
categories: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月', '一月2', '二月2', '三月2', '四月2', '五月2', '六月2', '七月2', '八月2', '九月2', '十月2', '十一月2', '十二月2', '一月3', '二月3', '三月3', '四月3', '五月3', '六月3', '七月3', '八月3', '九月3', '十月3', '十一月3', '十二月3'],
labels: {
allowOverlap: true,
}
},
看起来很简单,但似乎对我不起作用。这是一个错误吗,还是需要一些其他设置?
https://jsfiddle.net/khfyxLq1/
谢谢!
David
英文:
I'm trying to allow X axis label overlapping on a column chart in HighCharts but it doesn't seem to 'take'. In the API, it seems to say this should be done as follows:
xAxis: {
categories: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December','January2', 'February2', 'March2', 'April2', 'May2', 'June2', 'July2', 'August2', 'September2', 'October2', 'November2', 'December2','January3', 'February3', 'March3', 'April3', 'May3', 'June3', 'July3', 'August3', 'September3', 'October3', 'November3', 'December3'],
labels: {
allowOverlap: true,
}
},
It seems simple enough but it doesn't seem to be working for me. Is this a bug or is there some other setting needed?
https://jsfiddle.net/khfyxLq1/
Thank you!
David
答案1
得分: 1
要显示所有类别,您还需要将 step
设置为 1。
xAxis: {
categories: [...],
labels: {
allowOverlap: true,
step: 1
}
}
在线演示: https://jsfiddle.net/BlackLabel/gc2hetpj/
API 参考: https://api.highcharts.com/highcharts/xAxis.labels.step
英文:
To show all of the categories you need to also set step
to 1.
xAxis: {
categories: [...],
labels: {
allowOverlap: true,
step: 1
}
}
Live demo: https://jsfiddle.net/BlackLabel/gc2hetpj/
API Reference: https://api.highcharts.com/highcharts/xAxis.labels.step
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论