de.laures.cewolf.taglib
Class CewolfChartFactory

java.lang.Object
  extended by de.laures.cewolf.taglib.CewolfChartFactory
All Implemented Interfaces:
AxisConstants, ChartConstants, LayoutConstants

public abstract class CewolfChartFactory
extends java.lang.Object
implements ChartConstants, AxisConstants, LayoutConstants

Chart factory creates Jfreechart instances. To add a new factory use the CewolfChartFactory.registerFactory(new CewolfChartFactory() {...}); method.

Author:
Guido Laures

Field Summary
protected  java.lang.String chartType
           
 
Fields inherited from interface de.laures.cewolf.taglib.ChartConstants
AREA, AREA_XY, BUBBLE, CANDLE_STICK, COMBINED_XY, GANTT, HIGH_LOW, HORIZONTAL_BAR, HORIZONTAL_BAR_3D, LINE, METER, OVERLAY_CATEGORY, OVERLAY_XY, PIE, PIE_3D, SCATTER, SIGNAL, STACKED_AREA, STACKED_HORIZONTAL_BAR, STACKED_VERTICAL_BAR, STACKED_VERTICAL_BAR_3D, TIME_SERIES, VERRTICAL_XY_BAR, VERTICAL_BAR, VERTICAL_BAR_3D, WIND, XY
 
Fields inherited from interface de.laures.cewolf.taglib.AxisConstants
AXIS_TYPE_CATEGORY, AXIS_TYPE_DATE, AXIS_TYPE_NUMBER, ORIENTATION_HORIZONTAL, ORIENTATION_VERTICAL
 
Fields inherited from interface de.laures.cewolf.taglib.LayoutConstants
DOMAIN, RANGE
 
Constructor Summary
protected CewolfChartFactory(java.lang.String chartType)
          Creates a new instance of ChartFactory
 
Method Summary
static void check(org.jfree.data.general.Dataset data, java.lang.Class clazz, java.lang.String chartType)
          Helper to check if the given dataset is the expected type.
abstract  org.jfree.chart.JFreeChart getChartInstance(java.lang.String title, java.lang.String xAxisLabel, java.lang.String yAxisLabel, org.jfree.data.general.Dataset data)
          Callback when the chart instance to be created.
static org.jfree.chart.JFreeChart getChartInstance(java.lang.String chartType, java.lang.String title, java.lang.String xAxisLabel, java.lang.String yAxisLabel, org.jfree.data.general.Dataset data)
           
static org.jfree.chart.JFreeChart getCombinedChartInstance(java.lang.String chartType, java.lang.String title, java.lang.String xAxisLabel, java.lang.String yAxisLabel, java.util.List plotDefinitions, java.lang.String layout)
           
static org.jfree.chart.JFreeChart getOverlaidChartInstance(java.lang.String chartType, java.lang.String title, java.lang.String xAxisLabel, java.lang.String yAxisLabel, int xAxisType, int yAxisType, java.util.List plotDefinitions)
           
static void registerFactory(CewolfChartFactory factory)
          Register a new chart factory instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

chartType

protected java.lang.String chartType
Constructor Detail

CewolfChartFactory

protected CewolfChartFactory(java.lang.String chartType)
Creates a new instance of ChartFactory

Method Detail

getChartInstance

public abstract org.jfree.chart.JFreeChart getChartInstance(java.lang.String title,
                                                            java.lang.String xAxisLabel,
                                                            java.lang.String yAxisLabel,
                                                            org.jfree.data.general.Dataset data)
                                                     throws IncompatibleDatasetException
Callback when the chart instance to be created.

Parameters:
title - The title of chart
xAxisLabel - label on x axis
yAxisLabel - label on y axis
data - The dataset to create chart for
Returns:
The newly created JFreeChart instance
Throws:
IncompatibleDatasetException - If the incoming data is not compatible with this factory

registerFactory

public static void registerFactory(CewolfChartFactory factory)
Register a new chart factory instance.

Parameters:
factory - The factory to register

getChartInstance

public static org.jfree.chart.JFreeChart getChartInstance(java.lang.String chartType,
                                                          java.lang.String title,
                                                          java.lang.String xAxisLabel,
                                                          java.lang.String yAxisLabel,
                                                          org.jfree.data.general.Dataset data)
                                                   throws ChartValidationException
Throws:
ChartValidationException

getOverlaidChartInstance

public static org.jfree.chart.JFreeChart getOverlaidChartInstance(java.lang.String chartType,
                                                                  java.lang.String title,
                                                                  java.lang.String xAxisLabel,
                                                                  java.lang.String yAxisLabel,
                                                                  int xAxisType,
                                                                  int yAxisType,
                                                                  java.util.List plotDefinitions)
                                                           throws ChartValidationException,
                                                                  DatasetProduceException
Throws:
ChartValidationException
DatasetProduceException

getCombinedChartInstance

public static org.jfree.chart.JFreeChart getCombinedChartInstance(java.lang.String chartType,
                                                                  java.lang.String title,
                                                                  java.lang.String xAxisLabel,
                                                                  java.lang.String yAxisLabel,
                                                                  java.util.List plotDefinitions,
                                                                  java.lang.String layout)
                                                           throws ChartValidationException,
                                                                  DatasetProduceException
Throws:
ChartValidationException
DatasetProduceException

check

public static void check(org.jfree.data.general.Dataset data,
                         java.lang.Class clazz,
                         java.lang.String chartType)
                  throws IncompatibleDatasetException
Helper to check if the given dataset is the expected type.

Parameters:
data - The dataset
clazz - Expected type (class)
chartType - The chart type string
Throws:
IncompatibleDatasetException - If not the expected class


Copyright © {inceptionYear}-2008 null. All Rights Reserved.