您可以将动态数据发送到处理小程序吗?
我有一个 ajax 页面,它从数据库中提取数据。 我想添加一个 processing 小程序来可视化数据,但我不知道如何更新数据变化时的可视化。 这个想法是能够将新数据推送到可视化中。
我不受制于加工技术,任何东西都可以。 处理似乎是让它看起来更漂亮的最简单的方法。 感谢您的建议。
I have an ajax page which pulls data from a database. I'd like to add a processing applet to visualize the data but i can't figure out how to update the visualization as the data changes. The idea is to be able to push new data into the visualization.
I'm not tied to the processing technology, anything will work. Processing just seems to be the easiest way to make it look nice. Thanks for the advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
最简单的方法是构建您自己的 XML 结构(如果需要,则使用 Base64 编码二进制数据)并在小程序中添加计时器以从服务器检索更新(通过 HTTP 请求)。 如何准备和处理 XML 由您决定。
小程序对于可视化来说有点繁重,因此如果可以在 Flash 中完成同样的事情,我建议使用它。 Flash 还支持 HTTP 请求(或者您可以让 javascript 处理它)。
The easiest way is to construct your own XML structure (base64 encode binary data if you need) and add a timer in your applet to retrieve updates from the server (through HTTP requests). How to prepare and process the XML is up to you.
Applets are a bit heavy-weight for visualization, so if the same thing can be done in Flash, I'd recommend using that instead. Flash also got support for HTTP requests (or you can let javascript handle it).
我不确定如何促进两者之间的沟通,但作为可能的替代方案,您可以查看 processing .js,这是用javascript实现的处理。
I'm not sure of how you could facilitate communication between the two, but as a possible alternative you could look at processing.js, which is processing implemented in javascript.
小程序在自己的沙箱中运行。 查看 java.net.URL 和 java.net.HttpURLConnection 类。
applets run in their own sandbox. Look at the java.net.URL and java.net.HttpURLConnection classes.
您可以从 java applet 发出 http 请求。 不过我对处理小程序一无所知。
You could make http requests from the java applet. I don't know anything about processing applets though.