admin管理员组文章数量:1314315
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?
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?
Share Improve this question edited Feb 5, 2012 at 16:12 hud asked Feb 3, 2012 at 21:45 hudhud 2031 gold badge5 silver badges13 bronze badges 2- Step option? Do you mean tickInterval? And what does "If the date range is is" mean? – Mark Commented Feb 4, 2012 at 21:35
- The angle bracket had hidden some of my text - updated – hud Commented Feb 5, 2012 at 16:13
1 Answer
Reset to default 7Does a bination of tickInterval and dateTimeLabelFormats achieve what you want?
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
month: '%d %b',
},
tickInterval: 86400000 * 31 // one month
}
Sample (fiddle here):
本文标签: javascriptHighcharts step amp offset x axis labelsStack Overflow
版权声明:本文标题:javascript - Highcharts step & offset x axis labels? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741960760a2407264.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论