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?
Why JFreeChartPanel can't creates image?
Re: Why JFreeChartPanel can't creates image?
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.
Regards,
DG.