How to return one PNG object from a JFreeChart

A discussion forum for the Eastwood Chart Servlet.
Locked
Chaniat
Posts: 3
Joined: Thu Mar 19, 2009 9:48 am

How to return one PNG object from a JFreeChart

Post by Chaniat » Thu Mar 19, 2009 9:59 am

Hello

I am using JFreeChart 1.1.11.

I would like include this java library into a web application (Servlet Bean and JSP)

Inside one bean, I would like write one getxxxx method, with the followed parameters
imput parameter: JFreeChart object
Output parameter: JPEG or PNG object

How can I.

Could you help me

Thank in advance

vbossica
Posts: 5
Joined: Sun Jun 29, 2008 10:26 pm

Re: How to return one PNG object from a JFreeChart

Post by vbossica » Sun Mar 22, 2009 4:42 pm

Something like the following should do the trick:

Code: Select all

    import org.jfree.chart.ChartUtilities;

    ChartUtilities.writeChartAsPNG(response.getOutputStream(), chart, width, height)

Locked