我的 Highcharts 图表中的 STEP 参数有什么问题?
What's the matter with the STEP parameter in my Highcharts graph?
我会说为 xAxis 定义 STEP 参数会相当简单。但是我的图表发生了一些奇怪的事情。一件事是,虽然我指定的 STEP 值为 1,但它每五年才显示一次。如果我将值增加到 2,它每十年显示一次。
这是设置(带有fiddle here):
"xAxis": {
"labels": {
"step": 1
},
"tickWidth": 0,
"showFirstLabel": true,
"showLastLabel": true
},
感谢您对此的任何帮助!
您不需要 step
。步骤是仅显示轴上的每个第 n 个标签。您需要 tickInterval
来设置标签的间隔。此外,您还需要 rotation
,因为标签之间的距离太近了:
"xAxis": {
"labels": {
"step": 1,
rotation: -45,
},
"tickWidth": 0,
tickInterval: 1,
"showFirstLabel": true,
"showLastLabel": true
}
这是DEMO
我会说为 xAxis 定义 STEP 参数会相当简单。但是我的图表发生了一些奇怪的事情。一件事是,虽然我指定的 STEP 值为 1,但它每五年才显示一次。如果我将值增加到 2,它每十年显示一次。
这是设置(带有fiddle here):
"xAxis": {
"labels": {
"step": 1
},
"tickWidth": 0,
"showFirstLabel": true,
"showLastLabel": true
},
感谢您对此的任何帮助!
您不需要 step
。步骤是仅显示轴上的每个第 n 个标签。您需要 tickInterval
来设置标签的间隔。此外,您还需要 rotation
,因为标签之间的距离太近了:
"xAxis": {
"labels": {
"step": 1,
rotation: -45,
},
"tickWidth": 0,
tickInterval: 1,
"showFirstLabel": true,
"showLastLabel": true
}
这是DEMO