When trying to call writeChartAsPNG with a width and height that is rather small (1), writeChartAsPNG loops and eventually ends up in a OutOfMemory exception. Of course 1 is a useless size, but it should return with an exception or do something else than looping.
Might be related to ticket 27.
Example code:
public class Test { public static void main(String[] args) { OutputStream output = new ByteArrayOutputStream(); XYDataset dataset = new TimeSeriesCollection(); JFreeChart chart = ChartFactory.createTimeSeriesChart("chart", "a", "b", dataset); int width = 1; int height = 1; try { ChartUtilities.writeChartAsPNG(output, chart, width, height, null); } catch (IOException e) { e.printStackTrace(); } } }
I think you are probably running into this issue:
http://www.jfree.org/forum/viewtopic.php?f=7&t=116818
If you download the latest JCommon version (1.0.22) the issue should be gone. Your test case is working for me with JCommon 1.0.22. I will close the bug, please reopen it if the issue is not resolved for you.
Fixed in JCommon version 1.0.22.