实时数据图
我想构建一个基于网络的实时数据图,我正在考虑不同的选项,例如:
- Html5 canvas
- 具有图形支持的 JS 库,例如 正如 Extjs
所说的实时,我的意思是,客户端每秒轮询一次 Web 服务器,或者使用反向 ajax;服务器在可用时将数据推送到客户端。
你能推荐一下吗?
I would like to build a web-based real time data graph and i'm looking at the different options such as:
- Html5 canvas
- JS libraries with graph support such
as Extjs
By real time i mean, either the client polling the web server say every second or using reverse ajax; the server pushes data to the client when available.
Can you please recommend any?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
还有 SmoothieCharts 专门针对此用例而设计。
There is also SmoothieCharts that is designed more for this use-case.
您可能需要考虑使用 Flot,这是一个基于 jQuery。
我假设实时意味着图表会自动更新。如果您要使用 AJAX 轮询以 1 秒的间隔获取和绘制数据,则代码如下所示:
请务必查看以下演示以查看其实际情况(单击“轮询数据”按钮) :
有关 Flot 的更多信息:
You may want to consider using Flot, an open-source plotting library based on jQuery.
I'm assuming that by real-time you mean that the graph will update automatically. The following is how your code would look like if you were to fetch and plot the data using AJAX polling at 1 second intervals:
Make sure to check out the following demo to see it in action (Click on the "Poll for Data" button):
For further information on Flot:
其他设计更漂亮、可能性更大的解决方案:
https://changelog.com/posts /rickshaw-realtime-javascript-graphing-library
示例:
http://shutterstock.github.com/rickshaw/examples/extensions.html
代码:
https://github.com/shutterstock/rickshaw
Other solution with design more nice and possibilities:
https://changelog.com/posts/rickshaw-realtime-javascript-graphing-library
example:
http://shutterstock.github.com/rickshaw/examples/extensions.html
code:
https://github.com/shutterstock/rickshaw