de.laures.cewolf.taglib
Class CewolfChartFactory
java.lang.Object
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
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 |
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)
|
private static int |
getChartTypeConstant(java.lang.String type)
|
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)
|
private static int |
getLayoutConstant(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 |
chartType
protected java.lang.String chartType
factories
private static java.util.Map factories
CewolfChartFactory
protected CewolfChartFactory(java.lang.String chartType)
- Creates a new instance of ChartFactory
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 chartxAxisLabel
- label on x axisyAxisLabel
- label on y axisdata
- 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
getChartTypeConstant
private static final int getChartTypeConstant(java.lang.String type)
getLayoutConstant
private static final int getLayoutConstant(java.lang.String layout)
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 datasetclazz
- Expected type (class)chartType
- The chart type string
- Throws:
IncompatibleDatasetException
- If not the expected class