我想在饼图上数据区后面显示百分比,用的是jfreechart,网上搜索后好象方法是下面的这个,
void setDataAreaRatio(double ratio) 
但是我不知道是不是这个,不知道怎么用,那个参数是怎么设置的啊?大家帮帮忙啊。

解决方案 »

  1.   

    这里有代码:http://dev2dev.bea.com.cn/bbs/thread.jspa?forumID=121&threadID=28066&tstart=0
      

  2.   

      // 图片中显示百分比:自定义方式,{0} 表示选项, {1} 表示数值, {2} 表示所占比例 ,小数点后两位 
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}({2})",NumberFormat.getInstance(), new DecimalFormat("0.00%")));
    // 图例显示百分比:自定义方式, {0} 表示选项, {1} 表示数值, {2} 表示所占比例 
    plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})"));