大哥帮我看看吧.. 有错误的指出来(标题不会乱码 其余的中文乱码) 代码如下:
import java.io.*;
import java.awt.*;
import org.jfree.chart.*;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.general.*;
public class PieChart{
public static void main(String[] args){String title="老师情况统计";
DefaultPieDataset piedata = new DefaultPieDataset();
piedata.setValue("高级职称",25.5);
piedata.setValue("中级职称",44.1);
piedata.setValue("初级职称及其他",33.4);
JFreeChart chart =ChartFactory.createPieChart(title,piedata,true,true,true);
chart.setTitle(new TextTitle(title,new Font("宋体",Font.ITALIC,25)));
chart.addSubtitle(new TextTitle("最后更新日期:2005年8月5日",new Font("宋体",Font.ITALIC,20)));
chart.setBackgroundPaint(Color.white);
try{
ChartUtilities.saveChartAsJPEG(new File("C:\\PieChart.jpg"),chart,600,600);
} catch (IOException exz){
System.out.print("Can't Creat image File");
}
}
}
import java.io.*;
import java.awt.*;
import org.jfree.chart.*;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.general.*;
public class PieChart{
public static void main(String[] args){String title="老师情况统计";
DefaultPieDataset piedata = new DefaultPieDataset();
piedata.setValue("高级职称",25.5);
piedata.setValue("中级职称",44.1);
piedata.setValue("初级职称及其他",33.4);
JFreeChart chart =ChartFactory.createPieChart(title,piedata,true,true,true);
chart.setTitle(new TextTitle(title,new Font("宋体",Font.ITALIC,25)));
chart.addSubtitle(new TextTitle("最后更新日期:2005年8月5日",new Font("宋体",Font.ITALIC,20)));
chart.setBackgroundPaint(Color.white);
try{
ChartUtilities.saveChartAsJPEG(new File("C:\\PieChart.jpg"),chart,600,600);
} catch (IOException exz){
System.out.print("Can't Creat image File");
}
}
}
解决方案 »
- 安了aptana插件,怎么找回熟悉的dynamic web project呢
- spring + struts1 为什么老是报请求的页面找不到?
- 为程序员正名贴!!!!
- ssh整合配置的时候出现问题The requested resource (Servlet action is not available) is not available.
- 抢分了,一些面试选择题,大侠们帮帮我。
- 请大家帮帮我:如何调用类
- struts资源文件
- struts中加入javascript 问题
- 用非抽象类实现接口时按理应该实现接口里的所有方法,但如下程序(可编译且运行无误)居然不要,为什么?
- 不确定对象进行数据解析
- 二级缓存的问题
- 疑问:是不是无锡的兄弟都做几年就往大城市去了?
/*------这句代码解决气球汉字乱码的问题-----------*/
PiePlot pieplot = (PiePlot)chart.getPlot(); // 通过JFreeChart 对象获得 plot:PiePlot!!
pieplot.setNoDataMessage("No data available"); // 没有数据的时候显示的内容
pieplot.setLabelFont(new Font("宋体", Font.PLAIN, 12));
/*------这句代码解决了底部汉字乱码的问题-----------*/
chart.getLegend().setItemFont(new Font("宋体", Font.PLAIN, 16));
/*------这句代码解决了顶部汉字乱码的问题-----------*/
chart.getTitle().setFont(new Font("宋体", Font.PLAIN, 28));