1 package de.laures.cewolf.taglib; 2 3 import java.io.Serializable ; 4 import java.util.ArrayList ; 5 import java.util.List ; 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 20 public class CombinedChartDefinition extends AbstractChartDefinition implements Serializable { 21 private String layout; 22 23 private List plotDefinitions = new ArrayList (); 24 private transient DrawingSupplier drawingSupplier = new DefaultDrawingSupplier(); 25 26 public void setLayout(String layout) { 27 this.layout = layout; 28 } 29 30 public Object 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 |