JfreeChart中文乱码解决方案
时间:2010-05-29 来源:mcuflower
柱状图(CategoryPlot):
CategoryPlot plot=chart.getCategoryPlot();//获取图表区域对象
CategoryAxis domainAxis=plot.getDomainAxis();
//水平底部列表
domainAxis.setLabelFont(new Font("黑体",Font.BOLD,14));
//水平底部标题
domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,12));
//垂直标题
ValueAxis rangeAxis=plot.getRangeAxis();//获取柱状
rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,15)); 饼图(PiePlot): JFreeChart chart = ChartFactory.createPieChart3D("IT行业职业分布图", dataset, true, false, false);
chart.getTitle().setFont(new Font("黑体",Font.BOLD,20));//设置标题字体
PiePlot piePlot= (PiePlot) chart.getPlot();//获取图表区域对象
piePlot.setLabelFont(new Font("黑体",Font.BOLD,10));
chart.getLegend().setItemFont(new Font("黑体",Font.BOLD,10)); 时序图(TimeSeries) XYPlot : XYPlot plot = (XYPlot) chart.getPlot();
//纵轴字体
plot.getRangeAxis().setLabelFont(new Font("宋体", Font.BOLD, 15));
//横轴框里的标题字体
chart.getLegend().setItemFont(new Font("宋体", Font.ITALIC, 15));
//横轴列表字体
plot.getDomainAxis().setTickLabelFont(new Font("新宋体", 1, 15));
//横轴小标题字体
plot.getDomainAxis().setLabelFont(new Font("新宋体", 1, 12)); 转自:http://blog.csdn.net/wanghuailong/archive/2009/03/11/3979620.aspx
//水平底部列表
domainAxis.setLabelFont(new Font("黑体",Font.BOLD,14));
//水平底部标题
domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,12));
//垂直标题
ValueAxis rangeAxis=plot.getRangeAxis();//获取柱状
rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,15)); 饼图(PiePlot): JFreeChart chart = ChartFactory.createPieChart3D("IT行业职业分布图", dataset, true, false, false);
chart.getTitle().setFont(new Font("黑体",Font.BOLD,20));//设置标题字体
PiePlot piePlot= (PiePlot) chart.getPlot();//获取图表区域对象
piePlot.setLabelFont(new Font("黑体",Font.BOLD,10));
chart.getLegend().setItemFont(new Font("黑体",Font.BOLD,10)); 时序图(TimeSeries) XYPlot : XYPlot plot = (XYPlot) chart.getPlot();
//纵轴字体
plot.getRangeAxis().setLabelFont(new Font("宋体", Font.BOLD, 15));
//横轴框里的标题字体
chart.getLegend().setItemFont(new Font("宋体", Font.ITALIC, 15));
//横轴列表字体
plot.getDomainAxis().setTickLabelFont(new Font("新宋体", 1, 15));
//横轴小标题字体
plot.getDomainAxis().setLabelFont(new Font("新宋体", 1, 12)); 转自:http://blog.csdn.net/wanghuailong/archive/2009/03/11/3979620.aspx
相关阅读 更多 +