[java]代码库
import java.awt.Font;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.plot.PiePlot;
import org.jfree.chart.title.LegendTitle;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.general.DefaultPieDataset;
public class Test3 {
public Test3() {
}
public static void main(String[] args) {
DefaultPieDataset dpd = new DefaultPieDataset();
dpd.setValue(\"管理人员\", 25);
dpd.setValue(\"市场人员\", 25);
dpd.setValue(\"开发人员\", 45);
dpd.setValue(\"其他人员\", 5);
// Create JFreeChart object
// 参数可以查看源码
JFreeChart chart = ChartFactory.createPieChart(\"公司组织架构图\", dpd, true,
true, false);
Font font = new Font(\"SimSun\", 10, 20);
TextTitle txtTitle = null;
txtTitle = chart.getTitle();
txtTitle.setFont(font);
PiePlot pieplot = (PiePlot)chart.getPlot();
pieplot.setLabelFont(font);
chart.getLegend().setItemFont(font);
ChartFrame pieFrame = new ChartFrame(\"公司组织架构图\", chart);
pieFrame.pack();
pieFrame.setFont(font);
pieFrame.setVisible(true);
}
}
//源代码片段来自云代码http://yuncode.net