[Java] java JFreeChart 中文处理 →→→→→进入此内容的聊天室

来自 , 2019-02-16, 写在 Java, 查看 136 次.
URL http://www.code666.cn/view/2387337b
  1. import java.awt.Font;
  2. import org.jfree.chart.JFreeChart;
  3. import org.jfree.chart.ChartFactory;
  4. import org.jfree.chart.ChartFrame;
  5. import org.jfree.chart.plot.PiePlot;
  6. import org.jfree.chart.title.LegendTitle;
  7. import org.jfree.chart.title.TextTitle;
  8. import org.jfree.data.general.DefaultPieDataset;
  9.  
  10. public class Test3 {
  11.  public Test3() {
  12.  }
  13.  
  14.  public static void main(String[] args) {
  15.   DefaultPieDataset dpd = new DefaultPieDataset();
  16.   dpd.setValue(\"管理人员\", 25);
  17.  dpd.setValue(\"市场人员\", 25);
  18.  dpd.setValue(\"开发人员\", 45);
  19.  dpd.setValue(\"其他人员\", 5);
  20.  
  21.  // Create JFreeChart object
  22.  // 参数可以查看源码
  23.  
  24.  JFreeChart chart = ChartFactory.createPieChart(\"公司组织架构图\", dpd, true,
  25.    true, false);
  26.  Font font = new Font(\"SimSun\", 10, 20);
  27.  TextTitle txtTitle = null;
  28.  txtTitle = chart.getTitle();
  29.  txtTitle.setFont(font);
  30.  PiePlot pieplot = (PiePlot)chart.getPlot();
  31.        pieplot.setLabelFont(font);  
  32.  chart.getLegend().setItemFont(font);
  33.  ChartFrame pieFrame = new ChartFrame(\"公司组织架构图\", chart);
  34.  pieFrame.pack();
  35.  pieFrame.setFont(font);
  36.  pieFrame.setVisible(true);
  37. }
  38. }
  39.  
  40. //源代码片段来自云代码http://yuncode.net
  41.                        

回复 "java JFreeChart 中文处理"

这儿你可以回复上面这条便签

captcha