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.