deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.graphics.charts
Class ChartsBuilder

java.lang.Object
  extended by org.deegree.graphics.charts.ChartsBuilder

public class ChartsBuilder
extends java.lang.Object

A Charts class with static methods. Its used to create de.latlon.charts from the given inputs.

Version:
$Revision: $, $Date: 27 Mar 2008 11:43:00$
Author:
Moataz Elmasry, last edited by: $Author: elmasri$

Field Summary
static int ORIENTATION_HORIZONTAL
          To indicate a horizontal chart type
static int ORIENTATION_VERTICAL
          To indicate a vertical chart type
protected static int VALUE_FORMAT_SERIES
          &CDU=23,25,21,26&SPD=42 23 33 36
protected static int VALUE_FORMAT_SIMPLE
          &CDU=34&SPD=36&Gruene=11
protected static int VALUE_FORMAT_UNKNOWN
          Unknown format
protected static int VALUE_FORMAT_XYSERIES
          &CDU=1970 23;1974,44;1978,43&SPD=1970,23;1974,44;1978,43
 
Constructor Summary
ChartsBuilder(ChartConfig chartConfigs)
           
 
Method Summary
protected  org.jfree.chart.JFreeChart configChart(org.jfree.chart.JFreeChart chart, ChartConfig chartConfigs)
          Initializes the chart with the values from the properties file config.properties
protected  org.jfree.chart.JFreeChart configLineChart(org.jfree.chart.JFreeChart chart, ChartConfig chartConfigs)
          Configures the pie chart according to the stored configurations file
protected  org.jfree.chart.JFreeChart configPieChart(org.jfree.chart.JFreeChart chart, ChartConfig chartConfigs)
          Configures the pie chart according to the stored configurations file
protected  org.jfree.data.category.CategoryDataset convertMapToCategoryDataSet(QueuedMap<java.lang.String,java.lang.String> keyedValues)
          It takes in a map a QueuedMap and converts it to a XYDataSet.
protected  org.jfree.data.xy.XYDataset convertMapToXYSeriesDataSet(QueuedMap<java.lang.String,java.lang.String> keyedValues)
          It takes in a map a QueuedMap and converts it to a XYDataSet.The two tokens of each tupel have to be numbers Format: key = x1,y1;x2,y2;x3,y3; Example row1 = 2,3;4,10;
 java.awt.image.BufferedImage createBarChart(java.lang.String title, QueuedMap<java.lang.String,java.lang.String> keyedValues, int width, int height, boolean is3D, boolean legend, boolean tooltips, int orientation, java.lang.String imageType, java.lang.String horizontalAxisName, java.lang.String verticalAxisName, ChartConfig chartConfigs)
          Creates a Bar chart
protected  java.awt.image.BufferedImage createBufferedImage(org.jfree.chart.JFreeChart chart, int width, int height, java.lang.String imageType)
          Creates a BufferedImage instance from a given chart, according to the given additional parameters
 java.awt.image.BufferedImage createLineChart(java.lang.String title, QueuedMap<java.lang.String,java.lang.String> keyedValues, int width, int height, boolean is3D, boolean legend, boolean tooltips, int orientation, java.lang.String imageType, java.lang.String horizontalAxisName, java.lang.String verticalAxisName, ChartConfig chartConfigs)
          Creates a Line chart
 java.awt.image.BufferedImage createPieChart(java.lang.String title, QueuedMap<java.lang.String,java.lang.Double> keyedValues, int width, int height, boolean is3D, boolean legend, boolean tooltips, java.lang.String lblType, java.lang.String imageType, ChartConfig chartConfigs)
          Create a pie 2D/3D Pie Chart
 java.awt.image.BufferedImage createXYLineChart(java.lang.String title, QueuedMap<java.lang.String,java.lang.String> keyedValues, int width, int height, boolean legend, boolean tooltips, int orientation, java.lang.String imageType, java.lang.String horizontalAxisName, java.lang.String verticalAxisName, ChartConfig chartConfigs)
          Creates an XY Line chart
protected  int mapImageformat(java.lang.String imgFormat)
          Maps the image format to an appropriate type, either RGB or RGBA (allow opacity).
protected  org.jfree.chart.plot.PlotOrientation translateToPlotOrientation(int orientation)
          Translates an integer that represents the chart orientation to a plot orientation instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORIENTATION_HORIZONTAL

public static final int ORIENTATION_HORIZONTAL
To indicate a horizontal chart type

See Also:
Constant Field Values

ORIENTATION_VERTICAL

public static final int ORIENTATION_VERTICAL
To indicate a vertical chart type

See Also:
Constant Field Values

VALUE_FORMAT_SIMPLE

protected static final int VALUE_FORMAT_SIMPLE
&CDU=34&SPD=36&Gruene=11

See Also:
Constant Field Values

VALUE_FORMAT_SERIES

protected static final int VALUE_FORMAT_SERIES
&CDU=23,25,21,26&SPD=42 23 33 36

See Also:
Constant Field Values

VALUE_FORMAT_XYSERIES

protected static final int VALUE_FORMAT_XYSERIES
&CDU=1970 23;1974,44;1978,43&SPD=1970,23;1974,44;1978,43

See Also:
Constant Field Values

VALUE_FORMAT_UNKNOWN

protected static final int VALUE_FORMAT_UNKNOWN
Unknown format

See Also:
Constant Field Values
Constructor Detail

ChartsBuilder

public ChartsBuilder(ChartConfig chartConfigs)
Parameters:
chartConfigs -
Method Detail

createPieChart

public java.awt.image.BufferedImage createPieChart(java.lang.String title,
                                                   QueuedMap<java.lang.String,java.lang.Double> keyedValues,
                                                   int width,
                                                   int height,
                                                   boolean is3D,
                                                   boolean legend,
                                                   boolean tooltips,
                                                   java.lang.String lblType,
                                                   java.lang.String imageType,
                                                   ChartConfig chartConfigs)
Create a pie 2D/3D Pie Chart

Parameters:
title -
keyedValues - The key/value pairs used for the pie chart
width - of the output image
height - height of the output image
is3D - is a 3D Chart
legend - for the output chart
tooltips - for the output chart
lblType - Possible types are Key, Value, KeyValue
imageType - of the output image
chartConfigs - to configure the output chart, or null to use the default ChartConfig
Returns:
BufferedImage representing the generated chart

createBarChart

public java.awt.image.BufferedImage createBarChart(java.lang.String title,
                                                   QueuedMap<java.lang.String,java.lang.String> keyedValues,
                                                   int width,
                                                   int height,
                                                   boolean is3D,
                                                   boolean legend,
                                                   boolean tooltips,
                                                   int orientation,
                                                   java.lang.String imageType,
                                                   java.lang.String horizontalAxisName,
                                                   java.lang.String verticalAxisName,
                                                   ChartConfig chartConfigs)
                                            throws IncorrectFormatException
Creates a Bar chart

Parameters:
title -
keyedValues - key is the category name, value is a series tupels as follows for instance key1 = (arg1,4);(arg2,6) key2 = (arg1,8); (arg2,11)
width - of the output image
height - height of the output image
is3D - is a 3D Chart
legend - for the output chart
tooltips - for the output de.latlon.charts
orientation - Horiyontal or vertical chart
imageType - of the output image
horizontalAxisName - Name of the Horizontal Axis
verticalAxisName - Name of the vertical Axis
chartConfigs - to configure the output chart, or null to use the default ChartConfig
Returns:
BufferedImage representing the generated chart
Throws:
IncorrectFormatException

createLineChart

public java.awt.image.BufferedImage createLineChart(java.lang.String title,
                                                    QueuedMap<java.lang.String,java.lang.String> keyedValues,
                                                    int width,
                                                    int height,
                                                    boolean is3D,
                                                    boolean legend,
                                                    boolean tooltips,
                                                    int orientation,
                                                    java.lang.String imageType,
                                                    java.lang.String horizontalAxisName,
                                                    java.lang.String verticalAxisName,
                                                    ChartConfig chartConfigs)
                                             throws IncorrectFormatException
Creates a Line chart

Parameters:
title -
keyedValues - key is the category name, value is a series tupels as follows for instance key1 = (arg1,4);(arg2,6) key2 = (arg1,8); (arg2,11)
width - of the output image
height - height of the output image
is3D - is a 3D Chart
legend - for the output chart
tooltips - for the output de.latlon.charts
orientation - Horiyontal or vertical chart
imageType - of the output image
horizontalAxisName - Name of the Horizontal Axis
verticalAxisName - Name of the vertical Axis
chartConfigs - to configure the output chart, or null to use the default ChartConfig
Returns:
BufferedImage representing the generated chart
Throws:
IncorrectFormatException

createXYLineChart

public java.awt.image.BufferedImage createXYLineChart(java.lang.String title,
                                                      QueuedMap<java.lang.String,java.lang.String> keyedValues,
                                                      int width,
                                                      int height,
                                                      boolean legend,
                                                      boolean tooltips,
                                                      int orientation,
                                                      java.lang.String imageType,
                                                      java.lang.String horizontalAxisName,
                                                      java.lang.String verticalAxisName,
                                                      ChartConfig chartConfigs)
                                               throws IncorrectFormatException
Creates an XY Line chart

Parameters:
title -
keyedValues - key is the category name, value is a series tupels Format: key = x1,y1;x2,y2;x3,y3 Example row1 = 2,3;4,10 Note that x and y have to be numbers
width - of the output image
height - height of the output image
legend - for the output chart
tooltips - for the output de.latlon.charts
orientation - Horiyontal or vertical chart
imageType - of the output image
horizontalAxisName - Name of the Horizontal Axis
verticalAxisName - Name of the vertical Axis
chartConfigs - to configure the output chart, or null to use the default ChartConfig
Returns:
BufferedImage representing the generated chart
Throws:
IncorrectFormatException

convertMapToCategoryDataSet

protected org.jfree.data.category.CategoryDataset convertMapToCategoryDataSet(QueuedMap<java.lang.String,java.lang.String> keyedValues)
                                                                       throws IncorrectFormatException
It takes in a map a QueuedMap and converts it to a XYDataSet. Format: key = RowName,Value;RowName,Value;RowName,Value Example row1 = col1,3;col2,10

Parameters:
keyedValues -
Returns:
CategoryDataSet
Throws:
IncorrectFormatException

convertMapToXYSeriesDataSet

protected org.jfree.data.xy.XYDataset convertMapToXYSeriesDataSet(QueuedMap<java.lang.String,java.lang.String> keyedValues)
                                                           throws IncorrectFormatException
It takes in a map a QueuedMap and converts it to a XYDataSet.The two tokens of each tupel have to be numbers Format: key = x1,y1;x2,y2;x3,y3; Example row1 = 2,3;4,10;

Parameters:
keyedValues -
Returns:
CategoryDataSet
Throws:
IncorrectFormatException

translateToPlotOrientation

protected org.jfree.chart.plot.PlotOrientation translateToPlotOrientation(int orientation)
Translates an integer that represents the chart orientation to a plot orientation instance

Parameters:
orientation -
Returns:
Horizontal plot orientation if orientation is Horizontal else Vertical

createBufferedImage

protected java.awt.image.BufferedImage createBufferedImage(org.jfree.chart.JFreeChart chart,
                                                           int width,
                                                           int height,
                                                           java.lang.String imageType)
Creates a BufferedImage instance from a given chart, according to the given additional parameters

Parameters:
chart -
width - of the generated image
height - of the generated image
imageType - ex image/png, image/jpg
Returns:
BufferedImage

configPieChart

protected org.jfree.chart.JFreeChart configPieChart(org.jfree.chart.JFreeChart chart,
                                                    ChartConfig chartConfigs)
Configures the pie chart according to the stored configurations file

Parameters:
chart -
chartConfigs - to configure the output chart
Returns:
configured JFreeChart

configLineChart

protected org.jfree.chart.JFreeChart configLineChart(org.jfree.chart.JFreeChart chart,
                                                     ChartConfig chartConfigs)
Configures the pie chart according to the stored configurations file

Parameters:
chart -
chartConfigs - to configure the output chart
Returns:
configured JFreeChart

configChart

protected org.jfree.chart.JFreeChart configChart(org.jfree.chart.JFreeChart chart,
                                                 ChartConfig chartConfigs)
Initializes the chart with the values from the properties file config.properties

Parameters:
chart -
chartConfigs - to configure the output chart
Returns:
initialized chart

mapImageformat

protected int mapImageformat(java.lang.String imgFormat)
Maps the image format to an appropriate type, either RGB or RGBA (allow opacity). There are image types that allow opacity like png, while others don't, like jpg

Parameters:
imgFormat -
Returns:
BufferedImage Type INT_ARGB if the mime type is image/png or image/gif INT_RGB else.

deegree 2.5 (2011/06/29 09:44 build-8-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org