/*
* Created on 2003-9-9
* http://www.sentom.net
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package net.sentom.chart;
/**
* @author sentom
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class WebChart {
private DefaultPieDataset data = new DefaultPieDataset();
public void setValue(String key,double value){
data.setValue(key,value);
}
public String generatePieChart(String title, HttpSession session, PrintWriter pw) {
String filename = null;
try {
JFreeChart chart = ChartFactory.createPie3DChart("饼型图", // chart title
data, // data
true, // include legend
true,
false
);
//设置图片的背景色
chart.setBackgroundPaint(java.awt.Color.white);
//设置图片标题的字体和大小
Font font = new Font("黑体",Font.CENTER_BASELINE,20);
TextTitle _title = new TextTitle(title);
_title.setFont(font);
chart.setTitle(_title);
//chart.setAntiAlias(false);