luffykingsc

JFreeChart chart = ChartFactory.createPieChart3D(title, // 图表标题 
dataset, true, // 是否显示图例 
false, false); 
PiePlot pieplot = (PiePlot) chart.getPlot(); //通过JFreeChart 对象获得 
pieplot.setNoDataMessage("无数据可供显示!"); // 没有数据的时候显示的内容 
pieplot.setLabelGenerator(new StandardPieSectionLabelGenerator( 
("{0}: ({2})"), NumberFormat.getNumberInstance(), 
new DecimalFormat("0.00%"))); 


    其中new StandardPieSectionLabelGenerator( 
("{0}: ({1},{2})"), NumberFormat.getNumberInstance(), 
new DecimalFormat("0.00%")) 
    的("{0}: ({1},{2})")是生成的格式,{0}表示section名,{1}表示section的值,{2}表示百分比。可以自定义。而new DecimalFormat("0.00%")表示小数点后保留两位 

分类:

技术点:

相关文章:

  • 2022-02-05
  • 2021-12-04
  • 2021-12-13
  • 2022-01-16
  • 2022-01-02
  • 2022-01-28
  • 2022-01-05
  • 2021-03-27
猜你喜欢
  • 2021-06-21
  • 2022-02-01
  • 2021-11-27
  • 2022-12-23
  • 2022-01-29
  • 2021-05-31
  • 2021-08-28
相关资源
相似解决方案