java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/AxisFactory.java
changeset 1 639991d0808a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/java/cewolf-1.0/src/main/java/de/laures/cewolf/taglib/AxisFactory.java	Sat Feb 28 21:31:02 2009 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +package de.laures.cewolf.taglib;
     1.5 +
     1.6 +import org.apache.commons.logging.Log;
     1.7 +import org.apache.commons.logging.LogFactory;
     1.8 +import org.jfree.chart.axis.Axis;
     1.9 +import org.jfree.chart.axis.CategoryAxis;
    1.10 +import org.jfree.chart.axis.DateAxis;
    1.11 +import org.jfree.chart.axis.NumberAxis;
    1.12 +import org.jfree.chart.axis.ValueAxis;
    1.13 +
    1.14 +/**
    1.15 + * @author guido
    1.16 + *
    1.17 + * To change this generated comment edit the template variable "typecomment":
    1.18 + * Window>Preferences>Java>Templates.
    1.19 + * To enable and disable the creation of type comments go to
    1.20 + * Window>Preferences>Java>Code Generation.
    1.21 + */
    1.22 +public class AxisFactory implements AxisConstants {
    1.23 +
    1.24 +    protected Log log = LogFactory.getLog(AxisFactory.class.getName());
    1.25 +    
    1.26 +    private static final AxisFactory instance = new AxisFactory();
    1.27 +    
    1.28 +    protected AxisFactory(){
    1.29 +    }
    1.30 +    
    1.31 +    public static final AxisFactory getInstance(){
    1.32 +    	return instance;
    1.33 +    }
    1.34 +    
    1.35 +	public Axis createAxis(int orientation, int type, String label) {
    1.36 +		switch (type) {
    1.37 +			case AXIS_TYPE_DATE :
    1.38 +				return new DateAxis(label);
    1.39 +			case AXIS_TYPE_NUMBER :
    1.40 +				return new NumberAxis(label);
    1.41 +			case AXIS_TYPE_CATEGORY://added by lrh 2005-07-11
    1.42 +	            return new CategoryAxis(label);
    1.43 +			default:
    1.44 +				throw new RuntimeException("unsupported axis type constant " + type);
    1.45 +		}
    1.46 +	}
    1.47 +
    1.48 +}