Java JfreeChart Chinese processing

From , 5 Years ago, written in Java, viewed 221 times.
URL https://pastebin.vip/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.                        

Reply to "Java JfreeChart Chinese processing"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website