org.xwiki.chart.internal
Class DefaultChartGenerator
java.lang.Object
org.xwiki.chart.internal.DefaultChartGenerator
- All Implemented Interfaces:
- ChartGenerator, Initializable
@Component
public class DefaultChartGenerator
- extends Object
- implements ChartGenerator, Initializable
The default implementation of ChartGenerator
component interface which utilizes the jfreechart charting
library.
- Since:
- 2.0M1
Method Summary |
byte[] |
generate(ChartModel model,
Map<String,String> parameters)
Generates an image of a chart representing the data presented as a ChartModel and extra formatting
parameters provided in the parameters map. |
void |
initialize()
Method called by the Component Manager when the component is created for the first time (i.e. |
void |
setDefaultParams(Map<String,String> parameters)
Sets up default values for certain parameters, if they are not provided. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultChartGenerator
public DefaultChartGenerator()
initialize
public void initialize()
throws InitializationException
- Description copied from interface:
Initializable
- Method called by the Component Manager when the component is created for the first time (i.e. when it's looked up
for the first time or if the component is specified as being loaded on startup). If the component instantiation
strategy is singleton then this method is called only once during the lifecycle of the Component Manager.
Otherwise the component is created at each lookup and thus this method is called at each lookup too.
- Specified by:
initialize
in interface Initializable
- Throws:
InitializationException
- if an error happens during a component's initialization
generate
public byte[] generate(ChartModel model,
Map<String,String> parameters)
throws ChartGeneratorException
- Description copied from interface:
ChartGenerator
- Generates an image of a chart representing the data presented as a
ChartModel
and extra formatting
parameters provided in the parameters map.
- Specified by:
generate
in interface ChartGenerator
- Parameters:
model
- the ChartModel
which defines the data model to be represented by the chart.parameters
- extra parameters for controlling various features of the image output.
- Returns:
- the chart image (binary).
- Throws:
ChartGeneratorException
- if the ChartGenerator
is unable to render a chart.
setDefaultParams
public void setDefaultParams(Map<String,String> parameters)
- Sets up default values for certain parameters, if they are not provided.
- Parameters:
parameters
- the parameter set which the values are to be put into