1 package de.laures.cewolf.taglib; 2 3 import org.apache.commons.logging.Log; 4 import org.apache.commons.logging.LogFactory; 5 import org.jfree.chart.axis.Axis; 6 import org.jfree.chart.axis.CategoryAxis; 7 import org.jfree.chart.axis.DateAxis; 8 import org.jfree.chart.axis.NumberAxis; 9 import org.jfree.chart.axis.ValueAxis; 10 11 19 public class AxisFactory implements AxisConstants { 20 21 protected Log log = LogFactory.getLog(AxisFactory.class.getName()); 22 23 private static final AxisFactory instance = new AxisFactory(); 24 25 protected AxisFactory(){ 26 } 27 28 public static final AxisFactory getInstance(){ 29 return instance; 30 } 31 32 public Axis createAxis(int orientation, int type, String label) { 33 switch (type) { 34 case AXIS_TYPE_DATE : 35 return new DateAxis(label); 36 case AXIS_TYPE_NUMBER : 37 return new NumberAxis(label); 38 case AXIS_TYPE_CATEGORY: return new CategoryAxis(label); 40 default: 41 throw new RuntimeException ("unsupported axis type constant " + type); 42 } 43 } 44 45 } 46 | Popular Tags |