Receiving incorrect datetimes when using milliseconds for x-axis?

寵の児 提交于 2019-12-24 00:26:32

问题


Here is a link to the jsfiddle. For some reason my datetimes are showing up incorrectly as you can see below.

I have confirmed that the milliseconds were correct so I'm led to believe that it's a bug with the library however I've seen examples using Date.UTC that work correctly but I can't seem to find any examples in their documentation that uses milliseconds instead.

Millisecond values were: 1326113281133,1326113401128, 1326113521102, 1326113641108,1326113761129,1326113881139,1326114001156,1326114241198.

Any help would be much appreciated in helping to find out the cause of this issue.


回答1:


its not a bug in the library, the timestamps are shifted to Universal Time in the chart.

use the following code before your chart variable declaration

Highcharts.setOptions({
global: {
    useUTC: false
}
});

here is the reference to use this option http://www.highcharts.com/ref/#global--useUTC



来源:https://stackoverflow.com/questions/8791859/receiving-incorrect-datetimes-when-using-milliseconds-for-x-axis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!