流程图 x 轴时间问题... AARGHHH
我很难将数据显示在以 x 轴作为时间线的流程图中。这是我的 JSON 文件的缩写副本:
{
"label": "ServiceReport",
"data": [[1328983200, 53], [1328986800, 53], [1328990400, 60]]
}
我已按照 Flot API 页面上的教程以及 stackoverflow 上的这个
没有任何运气。
修改 x 轴时,图形显示得很好,但 x 轴为空白。
xaxis: { mode: "time", minTickSize: [1, "hour"]}
这显示 8 到 8 个值(根据数据文件不正确),但没有图形数据:
xaxis: { mode: "time", minTickSize: [1, "hour"],
min: (new Date("2000/01/01")).getTime(),
max: (new Date("2000/01/02")).getTime()
}
基本上,我只想在 x 上显示时间(实际上是任何格式:5:00、凌晨 5 点,没关系) - 轴,并且 y 轴与服务值相关。每个数据文件中总共有 24 个时间戳(一天的数据)。
如果您能得到 Flot 和 JavaScript/jQuery 专家的任何帮助,我们将不胜感激!
I am having a difficult time getting my data to display inside of a Flot chart with the x-axis serving as the timeline. Here is an abbreviated copy of my JSON file:
{
"label": "ServiceReport",
"data": [[1328983200, 53], [1328986800, 53], [1328990400, 60]]
}
I've followed the tutorials on the Flot API page, as well as this one on stackoverflow
without any luck.
When modifying the x-axis, this gets the graph to display just fine, but the x-axis is blank.
xaxis: { mode: "time", minTickSize: [1, "hour"]}
This displays 8 through 8 values (not correct according to data file), but no graph data:
xaxis: { mode: "time", minTickSize: [1, "hour"],
min: (new Date("2000/01/01")).getTime(),
max: (new Date("2000/01/02")).getTime()
}
Basically, I just want to display the hours in (really any format: 5:00, 5 AM, doesn't matter) on the x-axis, and have the y-axis correlate to the Service Values. There are 24 total timestamps in each data file (one day's worth of data).
Any help from you Flot and JavaScript/jQuery experts would be greatly appreciated!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先是显示时间,使用:
我对 JSON 数据也有同样的问题,这是由错误的 JSON 编码文件引起的。
您确定您的 JSON 文件确实是 JSON 文件吗?
让我们尝试类似的方法来测试它(例如使用 jquery):
最后一点,您的时间戳不正确,正确的时间戳类似于“1328983200000”而不是“1328983200”,如果您使用 PHP 生成 JSON 数据,确保你对日期做了类似的事情:
First for the time to display, use :
I had the same problems with JSON data, caused by a bad JSON encoding file.
Are you sure that your JSON file is really a JSON file ?
Let's try something ike that to test it (with jquery for example) :
Last point, your timestamp is not correct, correct time stamp is like that "1328983200000" not like that "1328983200", if you use PHP to generate your JSON data, make sure you do something like that for the dates :