什么是在网站上创建图表的好方法? [英] What would be a good way of creating graph on a website?

查看:144
本文介绍了什么是在网站上创建图表的好方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库中得到了一堆数据。我们的目标是以一种可读的方式将它们呈现给用户,并且由于它们是股票数据,因此需要有一个图表。



现在它带来了一个问题:哪种方法会更好,动态地在服务器端创建图形还是让服务器只需推送原始数据,从而允许客户端生成图形?例如,我看到有一些jQuery库可用于此目的,例如 flot



我通常更喜欢在客户端做尽可能少的事情,但这次我想知道:在客户端生成图表会产生较低的服务器负载。

此外,更改某些参数(如显示不同位数的数据)只需要使用ajax和重绘图从服务器获取缺少的数据,而不是获取完全不同的图像。这将提供更响应的用户界面。



我看到 Google财经

a>在他们的图表中使用了flash,但是如果可能的话,我想避免它...

解决方案

这边为用户提供了更多的机会。在这方面,在服务器上生成一个位图是非常糟糕的,就像你提到的那样,它会增加你的服务器负载。



在这种情况下去找。浏览器支持非常好,它不会浪费客户资源,并且您可以轻松地为用户提供一些额外的功能,如放大或激活和停用部分数据。当然,flot图表看起来也不错。

I got a bunch of data in a database. The goal is to present them to a user in a readable way, and since they're stock-data, there needs to be a graph there.

Now it brings one question: which approach would be better, to create a graph on a server side dynamically or let the server just push raw data, allowing the client to generate graph? I saw there are some jQuery libraries for doing this, flot for example.

I usually prefer to do as little as possible on the client side, but this time I wonder: generating the graph on client side would produce lower server load.

Also, changing some parameter (like displaying data for bit diffrent timespan) would require only to fetch missing data from server with ajax and redraw graph, instead of fetching completly diffrent image. This would give a more responsive UI.

I saw that Google Finance uses flash for their graphs, but I'd like to avoid it if it's possible...

解决方案

The client-side offers more opportunities for the user here. Generating a bitmap on the server is pretty lame in that regard, and as you mentioned, it adds to your server load.

I'd go for flot in that case. Browser support is really good, it isn't wasteful with client resources, and you can easily give your users a couple of extra features like zooming in or activating and deactivating part of the data. Of course, flot graphs also look quite nice.

这篇关于什么是在网站上创建图表的好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆