日期:2014-05-19 浏览次数:20657 次
HttpServletRequest request=ServletActionContext.getRequest(); HttpSession session=request.getSession(); CategoryDataset dataset = DatasetUtilities.createCategoryDataset(rowKeys, columnKeys, data); JFreeChart chart = ChartFactory.createBarChart3D(title, x, y, dataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot plot = chart.getCategoryPlot(); //设置字体,不然会中文乱码 Font font = new Font("宋体", Font.BOLD, 16); TextTitle title1 = new TextTitle(title, font); chart.setTitle(title1); //标题 NumberAxis numberaxis = (NumberAxis) plot.getRangeAxis(); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setTickLabelFont(new Font("sans-serif", Font.PLAIN, 11)); /*------设置X轴坐标上的文字-------*/ domainAxis.setLabelFont(new Font("宋体", Font.PLAIN, 12)); /*------设置X轴的标题文字------------*/ numberaxis.setTickLabelFont(new Font("sans-serif", Font.PLAIN, 12)); /*------设置Y轴坐标上的文字-----------*/ numberaxis.setLabelFont(new Font("黑体", Font.PLAIN, 12)); /*------设置Y轴的标题文字------------*/ chart.getLegend().setItemFont(new Font("宋体", Font.PLAIN, 12));
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>