点不与flot图表上的x轴对齐 [英] points aren't aligned with the x axis on flot chart
问题描述
我有flot数据,其中x轴上的点与行不对齐。
I've got flot data where the points on the xaxis aren't aligned with the lines.
具体来说,请看一下这张照片:
specifically, take a look at this photo:
这是我正在使用的原始数据:
this is the raw data that I'm using:
[0] : [1327305600000,1989],
[1] : [1327392000000,3222.33333333333],
[2] : [1327564800000,1481.5],
[3] : [1327651200000,2061],
[4] : [1327910400000,1434],
[5] : [1327996800000,1504.75],
[6] : [1328083200000,1422.4]
这是我传给flot的javascript:
and this is the javascript that I'm passing to flot:
$.plot($("#something"), [datapoints], {
series: {
lines: { show: true , shadowSize:0},
points: { show: true }
},
xaxis: {
mode: "time",
timeformat: "%m/%d/%y",
reserveSpace: true
},
clickable: true,
hoverable: true,
legend: {
show: true
}
});
具体来说,请看第二点。它的时间戳是1327392000000,您可以从以下代码中看到,这应该与1/24/2012 x轴点对齐,但事实并非如此。
specifically, look at the second point. The timestamp for it is 1327392000000, and you can see from the following code that this should be aligned with the 1/24/2012 x-axis point, but it's not.
var d =新日期(1327392000000);
=> Tue Jan 24 00:00:00 PST 2012
如果我有办法解决这个问题,我很乐意听到。
If there's any way I can workaround this, I'd love to hear it.
谢谢!
推荐答案
按照以下方式:
- http://code.google.com/p/flot/issues/detail?id=608
时间应该是UTC,而不是PST。
the time should be UTC, not PST.
这篇关于点不与flot图表上的x轴对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!