I have a web application in which graph charts are displayed on the client side. On the client side i have JSP, OpenLaszlo Server.There is functionality for generating charts using OpenLaszlo but i don't want to use that.
The mechanism running presently in my application for generating and rendering the graph charts is as follows:
a) The data is fetched from the database, b) Using the data obtained in step a) a graph chart(a jpg image) is generated on the server using ChartDirector application and this generated chart's name is sent in response to the client.
But this is not a feasible way to achieve this functionality.
Thus i am looking out for some alternative tools(if possible, free/open source to use) which i can use for the generating the graph charts on the client side, using the data - for the graphs to be generated - received from the server in an XML file.
So please guide me regarding the above mentioned query.
Thanks in advance. Jignesh
The Art Of Life Is To Know When To Be Useless And When To Be Useful - CHUANG TZU
A common way for Java web apps to display charts is to use the cewolf tag library in JSP pages, which relies on the JFreeChart library to create those charts on the server (some links and examples for both can be found here).
Why do you want to create the chart on the client instead of the server? Or -seeing that you characterize JSP as client-side- do you mean in the web tier? [ December 04, 2007: Message edited by: Ulf Dittmer ]
Joined: Dec 28, 2004
Thanks for the reply.
As i had mentioned i have JSP and Openlaszlo both being used for the rendering the data on the client side().To be more specific, the rendering of graph currently being generated on the server, is done using Openlaszlo generated .swf file.
The scenario is like this :
A list of employees name with checkboxes is rendered on the client using Openlaszlo.Now when the user clicks on one of the checkboxes and submits, request goes to the server, and for the selected employee's available data a corresponding performance graph is generated by ChartDirector application and this generated graph's name is sent in the response and the openlaszlo generated .swf file renders the graph on the client.
Now once again if the user selects the same employee and submits, a new graph is generated by ChartDirector application for the same employee data, even though, the earlier graph with the same data is lying there on the server.
Tried to use caching mechanism to not to generate the chart for the same data again, if the graph already lies on the server. But for production environment where the application will have thousands of users, there the caching mechanism also doesn't seem to be an efficient option as per me.
So what i am thinking of is sending an xml, containing the data for the graph, in response and a tool on client side which can parse the data from the sent xml and create a chart on the fly.
So if you can comment on this and suggest me some tools as required, it would be a great help.
Joined: Mar 22, 2005
So the question is not so much about not being able to use specific tools, but about how to implement efficient caching, which your current toolset seems not to be able to do.
The first question to answer is: is it necessary? While in theory it's nice not to have to regenerate a chart if the data hasn't changed, what's the point of investing time and effort in a cache if the performance gain isn't all that noticeable? How did you ascertain that you need to do this?
Furthermore, it sounds as if you are proposing to replace the charting solution that works with a different one with a better feature set. You'd need to have a very good reason to do that; in other words, the current (non-caching) solution must be prohibitively expensive for some definition of "expense". Is that the case?
Joined: Dec 28, 2004
The current tool(i.e ChartDirector application) which is being used to generate the chart does not provide any kind of inbuilt Caching mechanism.
I have myself implemented a LRU(removing the Least-Recently Used entries) cache using java.util.LinkedHashMap class.And i can see some performance gain w.r.t the current solution(non-caching and generating chart each time the request is submitted).
But don't you think that generating charts and keeping them stored on the server will consume a lot of server's hard-disk memory(in production environment where application will have thousands of users), even though, using the cache mechanism, i delete the chart, corresponding to the key stored in cache(, or in my case map), when the key gets removed from the cache.
Regarding your second point of replacing the charting solution, yes you are correct i am looking out for some better alternative(possibly open-source).
But my foremost concern is, how to get rid of the thing currently working because it is degrading the performance of the application.
And as per discussion with my team they are saying : Sending an xml, containing the data for the graph, in response and something on client side parse the data from the sent xml and create a chart on the fly.
And don't you think this is a better approach compared to caching mechanism ?