01: package de.laures.cewolf.taglib;
02:
03: import java.io.Serializable;
04: import java.util.ArrayList;
05: import java.util.List;
06:
07: import org.jfree.chart.JFreeChart;
08: import org.jfree.chart.plot.DefaultDrawingSupplier;
09: import org.jfree.chart.plot.DrawingSupplier;
10:
11: import de.laures.cewolf.ChartValidationException;
12: import de.laures.cewolf.DatasetProduceException;
13:
14: /**
15: * Chart definition subclass to handle combined charts
16: *
17: * @author guido
18: * @author tbardzil
19: */
20: public class CombinedChartDefinition extends AbstractChartDefinition
21: implements Serializable {
22: private String layout;
23:
24: private List plotDefinitions = new ArrayList();
25: private transient DrawingSupplier drawingSupplier = new DefaultDrawingSupplier();
26:
27: public void setLayout(String layout) {
28: this .layout = layout;
29: }
30:
31: public Object getDataset() throws DatasetProduceException {
32: return ((PlotDefinition) plotDefinitions.get(0)).getDataset();
33: }
34:
35: public void addPlot(PlotDefinition pd) {
36: pd.setDrawingSupplier(drawingSupplier);
37: plotDefinitions.add(pd);
38: }
39:
40: protected JFreeChart produceChart() throws DatasetProduceException,
41: ChartValidationException {
42: return CewolfChartFactory.getCombinedChartInstance(type, title,
43: xAxisLabel, yAxisLabel, plotDefinitions, layout);
44: }
45:
46: }
|