Can anybody post me some example source on how to export/Save a line chart to a gif? (or any other format)
In a nutshell I will be using Tomcat4 (jsp) to create the graphs and display them on a webpage as a image.
Sorry if this has been covered before, but I did a serach and nothing cropped up.
Kind regards,
Jason.
clarkjason@email.com
Saving Graphs as Images (Gif)
Re: Saving Graphs as Images (Gif)
The ChartUtilities class has a method writeChartAsPNG(...) that send a PNG format chart image to any OutputStream.
Regards,
DG.
Regards,
DG.
Re: Saving Graphs as Images (Gif)
Take a look at the servlet demo.
http://cvs.sourceforge.net/cgi-bin/view ... tDemo.java
In particular, you'll want to write your own servlet that imlements something similar to the doGet() method. In it you can use writeChartAsJPEG() or writeChartAsPNG() (stated by David above).
Then in your JSP you'll want something like
<img src="/servlet/com.foo.MyJFreeChartServlet">
At least that is what I've been testing out for a few days. It will be up to you whether you build the chart in the jsp (nice for quick development) or in the servlet.
http://cvs.sourceforge.net/cgi-bin/view ... tDemo.java
In particular, you'll want to write your own servlet that imlements something similar to the doGet() method. In it you can use writeChartAsJPEG() or writeChartAsPNG() (stated by David above).
Then in your JSP you'll want something like
<img src="/servlet/com.foo.MyJFreeChartServlet">
At least that is what I've been testing out for a few days. It will be up to you whether you build the chart in the jsp (nice for quick development) or in the servlet.