Flot documentation表示它基于javascript时间戳。
我试图将JSON
转换为符合此标准,我的JSON看起来像这样
{"label":"Activation","data": [
["1382061194000","10"],["1382061195000","9"],["1382061196000","9"],
["1382061197000","20"],["1382061198000","6"],["1382061203000","16"],
["1382061204000","12"],["1382061205000","14"],["1382061206000","22"],
["1382061207000","20"],["1382061208000","10"],["1382061209000","19"],
["1382061210000","13"],["1382061211000","9"],["1382061212000","12"],
["1382061214000","12"],["1382061215000","17"],["1382061216000","6"],
["1382061217000","14"],["1382061218000","22"],["1382061219000","43"],
["1382061220000","34"],["1382061221000","27"],["1382061222000","31"],
["1382061223000","2"],["1382061224000","1"],["1382061225000","86"],
["1382061226000","82"],["1382061227000","4"],["1382061228000","7"],
["1382061229000","6"],["1382061230000","18"],["1382061231000","17"],
["1382061232000","15"],["1382061233000","3"],["1382061234000","14"],
["1382061235000","2"],["1382061236000","8"],["1382061237000","14"],
["1382061238000","9"],["1382061239000","5"]
]}
我设置了像这样的flot选项
xaxis: {tickSize: 1,mode: "time", timeformat: "%H:%M:%S"}
图表从未上升:(
实际上目标很简单,我只想显示一个带有08:02:30
08:02:31
的flot图表作为xaxis信息。谢谢你的帮助。
答案 0 :(得分:4)
您的问题是您将日期作为字符串传递。
> new Date("1382061194000")
Invalid Date
> new Date(1382061194000)
Thu Oct 17 2013 21:53:14 GMT-0400 (EDT)
尝试删除引号(也在数据点周围),看看它是做什么的。