Highcharts 步骤&偏移x轴标签?
我有一些图表,其中我将日期值作为 x 轴标签传递。它们可以在任何日期范围内开始和结束。
如果日期范围大于 2 个月,那么我需要 x 轴仅显示每月 1 日的标签值。
我知道我可以使用 tickinterval 选项来实现间距,但我似乎无法强制标签从该月的第一天或第一个星期一开始,它们总是从范围内的第一个值开始。
这是我现在拥有的一个例子。日期范围是 11 月 13 日到 2 月 3 日:
这就是我想要的 x 轴的样子(这是经过photoshop处理的):
有办法实现这一点吗?
I've got some charts where I'm passing date values as the x axis labels. They could start and end on any date range.
If the date range is >2 months then I need the x axis to only show label values on the 1st of each month.
I know I can achieve the spacing with a tickinterval option, but I can't seem to force the labels to start on the 1st of the month or the first Monday, they always start from the first value in the range.
Here's an example of what I have now. The date range is 13th Nov to 3rd Feb:
And this is what I want the x axis to look like (this is photoshopped):
Is there a way to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
tickInterval 和 dateTimeLabelFormats 的组合是否能达到您想要的效果?
示例(小提琴此处):
Does a combination of tickInterval and dateTimeLabelFormats achieve what you want?
Sample (fiddle here):