在X轴上使用毫秒时接收到错误的日期时间? [英] Receiving incorrect datetimes when using milliseconds for x-axis?
问题描述
此处是 jsfiddle 的链接.由于某些原因,我的日期时间显示不正确,如下所示.
Here is a link to the jsfiddle. For some reason my datetimes are showing up incorrectly as you can see below.
我已经确认毫秒是正确的,所以我被认为是库中的一个错误,但是我看到使用Date.UTC的示例可以正常工作,但是我似乎无法在它们中找到任何示例而是使用毫秒为单位的文档.
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.
毫秒值是:1326113281133,1326113401128,1326113521102,1326113641108,1326113761129,1326113881139,1326114001156,1326114241198.
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.
推荐答案
它不是库中的错误,时间戳在图表中已转换为通用时间".
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
}
});
这是使用此选项的参考 http://www.highcharts.com/ref/#global--useUTC
here is the reference to use this option http://www.highcharts.com/ref/#global--useUTC
这篇关于在X轴上使用毫秒时接收到错误的日期时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!