我在使用jfreechar做饼图的时候,想在标签上显示百分比功能,在google上搜得可以使用:PiePlot plot = (PiePlot)chart.getPlot();
plot.setLabelGenerator(new StandardPieItemLabelGenerator (StandardPieItemLabelGenerator.DEFAULT_TOOLTIP_FORMAT));
然后生成jpg文件输出:
FileOutputStream fos_jpg = new FileOutputStream("D:\\pi1.jpg");
ChartUtilities.writeChartAsJPEG(fos_jpg,100,chart,800,600,null);
编译没有错误.
但是我在运行得时候老是在ChartUtilities.writeChartAsJPEG报错,错误信息是:Exception in thread "main" java.lang.AbstractMethodError
at org.jfree.chart.plot.PiePlot.drawLeftLabels(PiePlot.java:1837)
at org.jfree.chart.plot.PiePlot.drawLabels(PiePlot.java:1808)
at org.jfree.chart.plot.PiePlot3D.draw(PiePlot3D.java:526)
at org.jfree.chart.JFreeChart.draw(JFreeChart.java:1039)
at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1213)
at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1193)
at org.jfree.chart.ChartUtilities.writeChartAsJPEG(ChartUtilities.java:473)
at hello.PieChart.main(PieChart.java:69)我已经把所有jfreeChar的包全部引入,我不知何故还是报错,跪求仙人指点迷津!