0
我試圖繪製使用flot和有一些問題的東西的持續時間。在我的SQL表我有兩個datetime列,我執行下面的選擇,讓他們之間的差額作爲與海軍報工作的時間戳(我認爲)圖表時間與Flot
$p1Query = $db->rawQuery("SELECT AVG((synth.page2-synth.page1)) AS difference FROM (SELECT (UNIX_TIMESTAMP(pageoneloadtime))*1000 AS page1, (UNIX_TIMESTAMP(pagetwoloadtime))*1000 AS page2 FROM usersession) synth");
$p1Average = floor($p1Query[0]['difference']);
我圖的JavaScript部分看起來是這樣的。
var pageTimeData = [["Page 1",<?= $p1Average ?>],["Page 2",<?= $p2Average ?>],["Page 3",<?= $p3Average ?>],["Page 4",<?= $p4Average ?>]];
$.plot("#pageTimeChart", [ pageTimeData ], {
series: {
bars: {
show: true,
barWidth: 0.6,
align: "center"
}
},
xaxis: {
mode: "categories",
tickLength: 0
},
yaxis: {
mode: "time",
timeformat: "%M:%S",
minTickSize:[2,"seconds"]
}
});
但我不明白爲什麼我的圖表不顯示任何酒吧。我已驗證我已加載必要的JavaScript文件