日期:2014-05-17 浏览次数:20767 次
JFreeChart viewBarChart2 = createBarChart2(); final ChartComposite frame_4 = new ChartComposite(composite, SWT.NONE, viewBarChart2, true); JFreeChart chart = ChartFactory.createBarChart3D("分布图", "月份", "销量", dataset, PlotOrientation.VERTICAL, false, true, true); CategoryPlot plot = chart.getCategoryPlot();// 获得图表对象 Font font = new Font("黑体", Font.BOLD, 15); // 画折线图 LineAndShapeRenderer line = new LineAndShapeRenderer(); line.setSeriesPaint(0, Color.YELLOW); line.setToolTipGenerator(new StandardCategoryToolTipGenerator()); plot.setRenderer(0, line); // 画柱状图 plot.setDataset(1, dataset); StackedBarRenderer3D bar = new StackedBarRenderer3D(); bar.setSeriesPaint(0, Color.GREEN); bar.setItemLabelGenerator(new StandardCategoryItemLabelGenerator()); plot.setRenderer(1, bar); plot.setForegroundAlpha(0.5f); chart.getTitle().setFont(font);