快捷搜索:

JfreeChart中文乱码解决方案

柱状图(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

您可能还会对下面的文章感兴趣: