JFreechart乱码的解决办法

对于饼图(PiePlot):

chart.getTitle().setFont(new Font("黑体", Font.PLAIN, 20));//标题
  PiePlot piePlot = (PiePlot) chart.getPlot();// 获取图表区域对象
  piePlot.setLabelFont(new Font("黑体", Font.BOLD, 10));

  chart.getLegend().setItemFont(new Font("黑体", Font.PLAIN, 12));//图释

 

柱状图(CategoryPlot):

CategoryPlot plot = (CategoryPlot)freeChart.getPlot();  
CategoryAxis domainAxis = plot.getDomainAxis();//(柱状图的x轴)  
domainAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//设置x轴坐标上的字体  
domainAxis.setLabelFont(new Font("宋体",Font.BOLD,20));//设置x轴上的标题的字体    
ValueAxis valueAxis = plot.getRangeAxis();//(柱状图的y轴)  
valueAxis.setTickLabelFont(new Font("宋体",Font.BOLD,20));//设置y轴坐标上的字体  
valueAxis.setLabelFont(new Font("宋体",Font.BOLD,20));//设置y轴坐标上的标题的字体 

chart.getLegend().setItemFont(new Font("黑体", Font.PLAIN, 12));//图释

时序图(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));


 

你可能感兴趣的:(jfreechart,plot)