Pie Chart NullPointerException

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

Pie Chart NullPointerException

Post by Adam Cassar » Thu Oct 24, 2002 3:42 am

Hi Guys,

I get the following error:

java.lang.NullPointerException
at sun.java2d.pipe.DuctusShapeRenderer.renderPath(DuctusShapeRenderer.java:53)
at sun.java2d.pipe.DuctusShapeRenderer.fill(DuctusShapeRenderer.java:49)
at sun.java2d.SunGraphics2D.fill(SunGraphics2D.java:2210)
at com.jrefinery.chart.Pie3DPlot.draw(Unknown Source)
at com.jrefinery.chart.JFreeChart.draw(Unknown Source)
at com.jrefinery.chart.JFreeChart.createBufferedImage(Unknown Source)
at com.jrefinery.chart.ChartUtilities.writeChartAsJPEG(Unknown Source)
at com.jrefinery.chart.ChartUtilities.writeChartAsJPEG(Unknown Source)

Using jfreechart-0.9.4 and jcommons-0.7.1 when making a 3d pie chart with
the following code with all the integers in the resultset being 0 or if there
is only one value and all the rest are 0. The 2d chart works fine with the above data.

com.jrefinery.data.DefaultPieDataset pieDataSet = new com.jrefinery.data.DefaultPieDataset();
for(Iterator i=result.keySet().iterator(); i.hasNext();)
{
String key=(String)i.next();
pieDataSet.setValue(key,(Integer)result.get(key));
}
JFreeChart chart=ChartFactory.createPie3DChart("Breakdown by TLD",pieDataSet,true);
chart.setBackgroundPaint(new Color(0xDDDDDD));
response.setContentType("/image/jpeg");

OutputStream out = response.getOutputStream();

ChartUtilities.writeChartAsJPEG(out, chart, 300, 250);

Dave Gilbert

Re: Pie Chart NullPointerException

Post by Dave Gilbert » Fri Oct 25, 2002 9:20 am

Hi Adam,

Thanks for reporting this. I was able to reproduce it easily, but haven't had a chance to fix the bug yet. Now, just as I was about to add a bug report on SourceForge, I notice that someone else already reported the bug and suggested a fix last month (id = 608001)...I'll add the fix in for 0.9.5.

Regards,

DG.

Locked