package pkg;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.data.general.DefaultPieDataset;
/**
* 生成饼状图 只展示,不生成文件
* 导入jar包 jaxen-1.1.1.jar,jcommon-1.0.12.jar,jfreechart-1.0.9.jar
* @author liudecai_zan@126.com
*
*/
public class Test {
public static void main(String[] args) {
DefaultPieDataset dpd = new DefaultPieDataset();
int a = 5;
int b = 35;
int c = 15;
int count = a + b + c;
dpd.setValue("超出实检上限总捆数" + "\n" + a, a);
dpd.setValue("实检范围内总捆数" + "\n" + b, b);
dpd.setValue("超出实检下限总捆数" + "\n" + c, c);
JFreeChart pieChart = ChartFactory.createPieChart(
"棒材异常磅单超重捆数信息" + "\n" + a + "+"+ b + "+" + c + "=" + count, dpd, true, true, false);
ChartFrame pieFrame = new ChartFrame("棒材异常磅单超重捆数信息图", pieChart);
pieFrame.pack();
pieFrame.setVisible(true);
}
}
柳德才
13691193654
18942949207
QQ:422157370
liudecai_zan@126.com湖北-武汉-江夏-庙山