01: /*
02: * Copyright 2006 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
07: * BI Platform. The Initial Developer is Pentaho Corporation.
08: *
09: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
10: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
11: * the license for the specific language governing your rights and limitations.
12: *
13: * @author Gretchen Moran
14: */
15: package org.pentaho.plugin.jfreereport.reportcharts;
16:
17: import org.jfree.chart.ChartFactory;
18: import org.jfree.chart.JFreeChart;
19: import org.jfree.chart.plot.PlotOrientation;
20: import org.jfree.chart.renderer.xy.XYAreaRenderer;
21: import org.jfree.data.time.TimeSeriesCollection;
22: import org.jfree.data.xy.XYDataset;
23: import org.jfree.data.xy.XYSeriesCollection;
24:
25: public class XYAreaChartExpression extends XYLineChartExpression {
26: private static final long serialVersionUID = -8475649582680588912L;
27:
28: public XYAreaChartExpression() {
29: super ();
30: }
31:
32: public JFreeChart getChart(XYDataset xyDataset) {
33:
34: JFreeChart rtn = null;
35:
36: if (xyDataset instanceof XYSeriesCollection) {
37: rtn = ChartFactory.createXYAreaChart(getTitle(),
38: getDomainTitle(), getRangeTitle(), xyDataset,
39: isHorizontal() ? PlotOrientation.HORIZONTAL
40: : PlotOrientation.VERTICAL, isShowLegend(),
41: false, false);
42: return rtn;
43: }
44:
45: if (xyDataset instanceof TimeSeriesCollection) {
46: rtn = ChartFactory.createTimeSeriesChart(getTitle(),
47: getDomainTitle(), getRangeTitle(), xyDataset,
48: isShowLegend(), false, false);
49:
50: rtn.getXYPlot().setRenderer(new XYAreaRenderer());
51:
52: return rtn;
53: }
54:
55: return rtn;
56: }
57:
58: }
|