Why JFreeChartPanel can't creates image?

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

Why JFreeChartPanel can't creates image?

Post by Raymond Chui » Wed May 29, 2002 3:10 pm

I have few lines:

JFreeChart chart = ChartFactory.createTimeSerisChart("Title",
"Date & Time", "Temperture",
new DefaultXYDataset(new String[] {"Washington"},
data, true);
JFreeChartPanel chartPanel = new JFreeChartPanel(chart);
Dimension d = chartPanel.getPreferredSize();
Image image = chartPanel.createImage(dimension.width, dimension.height);
MediaTracker tracker = new MediaTracker(chartPanel);
trakcer.addImage(image,1);
try {
trakcer.waitForID(1);
} catch (InterruptedException e) {;}
if (tracker.checkID(1,true))
System.out.println("Image is ready");
else
System.out.println("Image is loading");
if (image == null)
System.out.println("Image is null");

I got "Image is ready", but also got "Image is null".
Why is that?

David Gilbert

Re: Why JFreeChartPanel can't creates image?

Post by David Gilbert » Thu May 30, 2002 12:15 pm

I'm not familiar with the createImage method (which is part of java.awt.Component). If you are just trying to create an image containing a chart, try out the createBufferedImage(...) method in the JFreeChart class.

Regards,

DG.

Locked