<%@ page language="java" import="org.jfree.chart.ChartFactory, org.jfree.chart.JFreeChart, org.jfree.chart.plot.PlotOrientation,org.jfree.chart.servlet.ServletUtilities,
org.jfree.data.category.DefaultCategoryDataset,org.jfree.data.category.*,org.jfree.chart.axis.CategoryAxis,
org.jfree.chart.axis.ValueAxis,
org.jfree.chart.plot.CategoryPlot,
org.jfree.chart.title.TextTitle,java.awt.*,org.jfree.chart.title.LegendTitle,org.jfree.chart.axis.NumberAxis" contentType="text/html;charset=GB18030" pageEncoding="GB18030"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
   
    <title>My JSP 'jfreechartJsptest.jsp' starting page</title>
      </head>
  <body>
   <%
  DefaultCategoryDataset dataset = new DefaultCategoryDataset();
 dataset.addValue(610, "广州", "猪肉");
 dataset.addValue(220, "广州", "牛肉");
 dataset.addValue(530, "广州", "鸡肉");
 dataset.addValue(340, "广州", "鱼肉");
 JFreeChart chart = ChartFactory.createBarChart3D("肉类销量统计图",
                   "肉类",
                   "销量",
                   dataset,
                   PlotOrientation.VERTICAL,
                   false,
                   false,
                   false);
                   CategoryPlot plot = chart.getCategoryPlot();
   CategoryAxis domainAxis = plot.getDomainAxis();//x轴
  
    NumberAxis numberaxis = (NumberAxis) plot.getRangeAxis();    
  
   //ValueAxis numberaxis = plot.getRangeAxis(); //y轴
 
  TextTitle t = chart.getTitle();
   t.setFont(new Font("宋体",Font.BOLD,40));//标题文字
 
  domainAxis.setLabelFont(new Font("宋体",Font.BOLD,20));//x轴标题文字
  domainAxis.setTickLabelFont(new Font("黑体",Font.BOLD,10));//x轴坐标上文字
  numberaxis.setLabelFont(new Font("宋体",Font.BOLD,20));//y轴标题文字
  numberaxis.setTickLabelFont(new Font("黑体",Font.BOLD,10));//y轴坐标上文字
 // LegendTitle title=chart.getLegend();
 
// title.setItemFont(new Font("黑体",Font.BOLD,5));//图例文字
 String filename = ServletUtilities.saveChartAsPNG(chart, 500, 300,null,session);
 String graphURL = request.getContextPath() + "/DisplayChart?filename=" + filename;
 %>
  <img src="<%= graphURL %>"width=500 height=300 border=0 usemap="#<%= filename %>">
  </body>
</html>
 
 
附:标题乱码
Java代码   
  1. chart.getTitle().setFont(new Font("宋体", Font.BOLD,12));  
   chart.getTitle().setFont(new Font("宋体", Font.BOLD,12));


其他

Java代码   
  1.  1. CategoryAxis domainAxis = plot.getDomainAxis();     
  2.  2.   
  3.  3// NumberAxis  valueAxis=(NumberAxis) plot.getRangeAxis();    
  4.  4//有人说这个是水平方向设置的 方法。   
  5.  5. ValueAxis numberaxis = plot.getRangeAxis();   
  6.  6.      
  7.  7/*------设置X轴坐标上的文字-----------*/     
  8.  8. domainAxis.setTickLabelFont(new Font("sans-serif", Font.PLAIN, 11));      
  9.  9.      
  10. 10/*------设置X轴的标题文字------------*/     
  11. 11. domainAxis.setLabelFont(new Font("宋体", Font.PLAIN, 12));      
  12. 12.      
  13. 13/*------设置Y轴坐标上的文字-----------*/     
  14. 14. numberaxis.setTickLabelFont(new Font("sans-serif", Font.PLAIN, 12));      
  15. 15.      
  16. 16/*------设置Y轴的标题文字------------*/     
  17. 17. numberaxis.setLabelFont(new Font("黑体", Font.PLAIN, 12));      
  18. 18.      
  19. 19/*------这句代码解决了底部汉字乱码的问题-----------*/     
  20. 20. jfreechart.getLegend().setItemFont(new Font("宋体", Font.PLAIN, 12));