KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > laures > cewolf > taglib > CombinedChartDefinition


1 package de.laures.cewolf.taglib;
2
3 import java.io.Serializable JavaDoc;
4 import java.util.ArrayList JavaDoc;
5 import java.util.List JavaDoc;
6
7 import org.jfree.chart.JFreeChart;
8 import org.jfree.chart.plot.DefaultDrawingSupplier;
9 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 implements Serializable JavaDoc {
21     private String JavaDoc layout;
22
23     private List JavaDoc plotDefinitions = new ArrayList JavaDoc();
24     private transient DrawingSupplier drawingSupplier = new DefaultDrawingSupplier();
25
26     public void setLayout(String JavaDoc layout) {
27         this.layout = layout;
28     }
29
30     public Object JavaDoc getDataset() throws DatasetProduceException {
31         return ((PlotDefinition)plotDefinitions.get(0)).getDataset();
32     }
33
34     public void addPlot(PlotDefinition pd) {
35         pd.setDrawingSupplier(drawingSupplier);
36         plotDefinitions.add(pd);
37     }
38
39     protected JFreeChart produceChart() throws DatasetProduceException, ChartValidationException {
40         return CewolfChartFactory.getCombinedChartInstance(type, title, xAxisLabel, yAxisLabel, plotDefinitions, layout);
41     }
42
43 }
44
Popular Tags