JFreeChart chart = ChartFactory.createPieChart3D(title,data,true,true, false);
//设置图片的背景色
chart.setBackgroundPaint( new java.awt.Color(189,235,255));
//设置图片标题的字体和大小
Font font = new Font("黑体", Font.CENTER_BASELINE, 16);
TextTitle _title = new TextTitle(title);
_title.setFont(font);
chart.setTitle(_title);
PiePlot plot = (PiePlot) chart.getPlot();
plot.setInsets(new Insets(5, 5, 5, 5));
//在统计图片上建连结
plot.setStartAngle(270);
//指定显示的饼图上圆形还椭圆形
plot.setCircular(false);
// 设置饼图各部分标签字体
plot.setLabelFont(new Font("隶书",Font.PLAIN,15));
//指定图片的透明度
plot.setForegroundAlpha(1.0f);
// 没有数据时显示的消息
plot.setNoDataMessage("该项没有数据记录");
plot.setNoDataMessageFont(new Font("黑体", Font.CENTER_BASELINE, 16));
plot.setNoDataMessagePaint(Color.RED);
//抽离一个 section 出来,不支持3D
plot.setSectionOutlinePaint(Color.BLACK);
// 显示百分比
plot.setLabelGenerator(new StandardPieItemLabelGenerator(StandardPieItemLabelGenerator.DEFAULT_TOOLTIP_FORMAT));
//设置背景的透明度
plot.setBackgroundAlpha(0.6f);
//把生成的图片放到临时目录
ChartRenderingInfo info = new ChartRenderingInfo(new
StandardEntityCollection());
//500是图片长度,300是图片高度
filename = ServletUtilities.saveChartAsJPEG(chart, wPhoto, hPhoto, info,session);
ChartUtilities.writeImageMap(pw, filename, info);
//设置图片的背景色
chart.setBackgroundPaint( new java.awt.Color(189,235,255));
//设置图片标题的字体和大小
Font font = new Font("黑体", Font.CENTER_BASELINE, 16);
TextTitle _title = new TextTitle(title);
_title.setFont(font);
chart.setTitle(_title);
PiePlot plot = (PiePlot) chart.getPlot();
plot.setInsets(new Insets(5, 5, 5, 5));
//在统计图片上建连结
plot.setStartAngle(270);
//指定显示的饼图上圆形还椭圆形
plot.setCircular(false);
// 设置饼图各部分标签字体
plot.setLabelFont(new Font("隶书",Font.PLAIN,15));
//指定图片的透明度
plot.setForegroundAlpha(1.0f);
// 没有数据时显示的消息
plot.setNoDataMessage("该项没有数据记录");
plot.setNoDataMessageFont(new Font("黑体", Font.CENTER_BASELINE, 16));
plot.setNoDataMessagePaint(Color.RED);
//抽离一个 section 出来,不支持3D
plot.setSectionOutlinePaint(Color.BLACK);
// 显示百分比
plot.setLabelGenerator(new StandardPieItemLabelGenerator(StandardPieItemLabelGenerator.DEFAULT_TOOLTIP_FORMAT));
//设置背景的透明度
plot.setBackgroundAlpha(0.6f);
//把生成的图片放到临时目录
ChartRenderingInfo info = new ChartRenderingInfo(new
StandardEntityCollection());
//500是图片长度,300是图片高度
filename = ServletUtilities.saveChartAsJPEG(chart, wPhoto, hPhoto, info,session);
ChartUtilities.writeImageMap(pw, filename, info);