admin管理员组文章数量:1194606
My chart is displaying data day-by-day (user and system sent SMS/Newsletters). So time part is not relevant and unnecessary. Here is an example: / where time "12:00" is displayed.
How can I force Highcharts to never display the time part in a "datetime" axis?
EDIT: Highcharts will display dates w/wo times based on chart or screen size. I've updated jsfiddle removing some data and now it's displaying also time parts.
My chart is displaying data day-by-day (user and system sent SMS/Newsletters). So time part is not relevant and unnecessary. Here is an example: http://jsfiddle.net/uaxZP/1/ where time "12:00" is displayed.
How can I force Highcharts to never display the time part in a "datetime" axis?
EDIT: Highcharts will display dates w/wo times based on chart or screen size. I've updated jsfiddle removing some data and now it's displaying also time parts.
Share Improve this question edited Jul 9, 2012 at 14:37 gremo asked Jul 9, 2012 at 14:03 gremogremo 48.9k80 gold badges269 silver badges447 bronze badges 3- 2 Is this still a problem? I see only dates on your fiddle. – Mike Robinson Commented Jul 9, 2012 at 14:12
- i would think about using highstock since you have your data in this format – Mina Gabriel Commented Jul 9, 2012 at 14:20
- @MikeRobinson here we are, updated fiddle showing times. – gremo Commented Jul 9, 2012 at 14:29
2 Answers
Reset to default 12You can intercept the x-axis label function and change it's output. In my example, I've changed it to render short dates:
http://jsfiddle.net/uaxZP/3/
{ xAxis:
labels: {
formatter: function() {
return Highcharts.dateFormat("%b %e", this.value);
}
}
}
The xAxis.labels.formatter property allows control over this. You also may notice I'm using Highcharts.dateFormat, which is a utility function for rendering dates. This is not mandatory, but it's a nice built in feature. Documentation on the xAxis formatter is here:
http://www.highcharts.com/ref/#xAxis-labels--formatter
The easiest way to do is using "minTickInterval"
xAxis: {
minTickInterval: 24 * 3600 * 1000
}
http://api.highcharts.com/highcharts#xAxis.minTickInterval
本文标签: javascriptHighcharts datetime axishow to disable time part (show only dates)Stack Overflow
版权声明:本文标题:javascript - Highcharts datetime axis, how to disable time part (show only dates)? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738503395a2090396.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论