我用JFreeChart做一个饼图,分为数块,生成的jpg里会显示各块的名字,但却不会显示各块实际的数值,请问要怎样的方法才能让它显示呢?谢谢!

解决方案 »

  1.   

    chart = ChartFactory.createPieChart(combo.getText() + "调查结果", // chart
                        // title
                        createPieDataset(), // data
                        true, // include legend
                        true, // tooltips?
                        false // URLs?
                        );
                PiePlot pie = (PiePlot) (chart.getPlot());
                pie.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}={2}", NumberFormat.getNumberInstance(), new DecimalFormat("0.0%")));
    ////////////////////////////////////////////////////
    显示百分比,值在chart下方的图例说明显示的