Friday, February 11, 2011

Using the Google Chart API (cont'd) and caching images for retrieval

Yesterday I talked about using the Google Chart API on the server to send chart images to a client in response to a query. Today after meeting with my colleague, he revealed a more straightforward approach than trying to cache the generated images and retrieve them from the image tag.

Well, we're still doing that, but instead of generating the image data and sending that, we generate just the url string to send to the google chart site. Then we send that to the client, where it is embedded into an image tag. Now we don't have to cache any image data. However, we still might end up caching it for a simple reason. It would be nice for users to get a quasi-permanent link to a generated graph, so that they could type "address/graph?id=..." instead of having to put up with a Google Chart url string (which might be long depending on the dataset).

There are still some more things to add to the code before it is ready to integrate with the main project, but overall it will make a pretty nice addition.

No comments:

Post a Comment