can I have non-image (gif,png) jfreechart in servlet?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
lengrexin
Posts: 8
Joined: Mon Dec 31, 2007 8:13 pm

can I have non-image (gif,png) jfreechart in servlet?

Post by lengrexin » Mon Jul 28, 2008 2:48 pm

The Developer's guide showed a simple servlet with JFreeChart by converting the chart to a png. Is there any way I can show the jfreechart as is in a servlet? I want to keep the chart's features (zooming and etc). If it is possible, what is the common mime type? Would it be application/octet-stream ?

Thanks.

lengrexin
Posts: 8
Joined: Mon Dec 31, 2007 8:13 pm

Post by lengrexin » Mon Jul 28, 2008 4:03 pm

I need the jfreechart to embed in a web page.

I understand that an applet allows me to have all the features of a jfreechart. However, I cannot use an applet because I need access to a database on another server which is something applet prohibits. I know signing the applet will solve the problem but that requires me to re-sign it every six months, which I want to avoid.

So therefore, I want to know if there is an alternative.

If it is impossible to embed jfreechart without using an applet, please let me know. I just need a confirmation so I can stop trying with an servlet.


Thanks.

Mike Watts
Posts: 13
Joined: Mon May 08, 2006 1:27 pm

Post by Mike Watts » Mon Jul 28, 2008 5:21 pm

An applet is allowed to have full access to the server from which it comes - this is how I use JFreeChart: it runs in an applet ( which is in turn loaded from an HTML page ) and the applet connects to several servlets on the same server as the HTML page/applet and no signing is required for this.

BTW the default sign period is six months but you can set it to whatever you like - see the documentation for jarsigner. What a signed jar allows is access to the local machine i.e. the one which is running the browser displaying the applet.

There are other methods of providing graphs on a web page - basically you create an image at the server end, store it with some unique ID, then ask for the image via the normal HTML tag but of course this is not interactive e.g. you cannot zoom in using the normal JFreeChart method. You can serve up charts like this with JFreeChart either by rolling-it-yourself or you can use some of the schemes posted by others - certainly check out the JSF thread in the forum.

HTH

lengrexin
Posts: 8
Joined: Mon Dec 31, 2007 8:13 pm

Post by lengrexin » Mon Jul 28, 2008 6:43 pm

Thanks.
I've recently found out I can set the a time frame for a signed jar too.

Locked