jfreechart中文乱码解决方案

柱状图(CategoryPlot):

    CategoryPlotplot=chart.getCategoryPlot();//获取图表区域对象

   CategoryAxisdomainAxis=plot.getDomainAxis();
   //水平底部列表
   domainAxis.setLabelFont(new Font("黑体",Font.BOLD,14));
   //水平底部标题
   domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,12));
    //垂直标题
    ValueAxisrangeAxis=plot.getRangeAxis();//获取柱状
   rangeAxis.setLabelFont(new Font("黑体",Font.BOLD,15));

饼图(PiePlot):

    JFreeChart chart = ChartFactory.createPieChart3D("IT行业职业分布图",dataset, true, false, false);
   
   chart.getTitle().setFont(newFont("黑体",Font.BOLD,20));//设置标题字体
    PiePlotpiePlot= (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/article/details/3979620

你可能感兴趣的:(jfreechart中文乱码解决方案)