Server generated GIF/PNG charts

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Stefan Wildi

Server generated GIF/PNG charts

Post by Stefan Wildi » Mon Mar 26, 2001 3:29 pm

Can I use JFreeChart for the generation of charts as GIF/PNG files on a SUN server running Sybase ASE/EAS? My application does not allow for any client side Java, so I have to generate the complete chart as GIF/PNG and send it to the client's browser.

David Gilbert

RE: Server generated GIF/PNG charts

Post by David Gilbert » Wed Mar 28, 2001 12:29 pm

You can certainly generate GIF and PNG image files with JFreeChart - there's some sample code elsewhere in this forum for generating PNG files (you should be able to find it with a search). I've also added the code to the source in CVS on SourceForge (http://sourceforge.net/projects/jfreechart) so you could check it out of there if you want to.

One issue that has been reported - in the current JDK, Java2D (which JFreeChart uses) relies on having X running on your server. Some of the Java2D methods are passed on to native X functions, I guess. So if you don't have X running, you will have a problem running JFreeChart.

Regards,

DG.

Daniel Serodio

RE: Server generated GIF/PNG charts

Post by Daniel Serodio » Fri Mar 30, 2001 6:13 pm

I´m also interested in generating server-side jpegs or gifs, but I don´t know where this application will be hosted. What if the server is running on a WinNT server? Does the server need anything special besides the ¨usual¨ (JRE, servlet engine, etc)?

Thanks,
Daniel Serodio

David Gilbert

RE: Server generated GIF/PNG charts

Post by David Gilbert » Tue Apr 03, 2001 12:19 pm

I don't think you have the same issue with NT, since the native graphics functions that Java2D relies on are part of the operating system - they'll always be available, no matter what your server configuration.

Regards,

DG.

Andrew Perepelytsya

RE: Server generated GIF/PNG charts

Post by Andrew Perepelytsya » Thu May 09, 2002 6:40 pm

If you are using some Unix-system to host your server and it doesn't have an X-window sysyem runnig, there's still a workaround. There are plenty of virtual x-window systems available that cheat Java code (though not only Java ;). Try the search in Google, don't remember the links, but read a lot about it.

Hope this helps a bit to clear out the issue ;)

Deva

RE: Server generated GIF/PNG charts

Post by Deva » Tue May 28, 2002 2:26 pm

You can try xvfb (X virtual Frame buffer) to simulate an X installation for a headless system.

On the other hand you an also try JDK1.4 where they have an in built support for Virtual Frame buffers.

Raymond Chui

RE: Server generated GIF/PNG charts

Post by Raymond Chui » Thu May 30, 2002 1:25 pm

By used writeChartAsJPEG method in ChartUtilites class.
If I login to console of my UNIX system (Redhat Linux 7.2),
compiled the *.java file with the DISPLAY=:0.0. Then I have
no problem to dump the JFreeChart to JPEG.
But If I login to my system by telnet,
compiled the *.java file with DISPLAY=myhost:0.0
Then I got error message "can't connect to X11 server with DISPLAY
myhost:0.0

Locked