org.pentaho.chart.plugin.jfreechart.chart
Class JFreeChartGenerator

java.lang.Object
  extended by org.pentaho.chart.plugin.jfreechart.chart.JFreeChartGenerator
All Implemented Interfaces:
IJFreeChartGenerator
Direct Known Subclasses:
JFreeAreaChartGenerator, JFreeBarChartGenerator, JFreeDialChartGenerator, JFreeLineChartGenerator, JFreeMultiChartGenerator, JFreePieChartGenerator

public abstract class JFreeChartGenerator
extends Object
implements IJFreeChartGenerator

Top Level class that is extended by different chart type creators.

                            JFreeChartGenerator
                                   |
                     -----------------------------------------------------------------------------
                     |                                                            |               |
                JFreeBarChartGenerator                                           ....            ...
                     |
       -------------------------------------------------------
       |                 |                |                   |
   JFreeStackedGen   JFreeLayeredGen    JFreeCylinderGen   JFreeDefault
       |
 ---------------------------
 |                         |
 JFreeStackedPercent    JFreeStacked100Percent
 
Author: Ravi Hasija Date: May 14, 2008 Time: 4:24:46 PM To change this template use File | Settings | File Templates.


Constructor Summary
JFreeChartGenerator()
           
 
Method Summary
 org.jfree.chart.JFreeChart createChart(ChartDocumentContext chartDocContext, ChartTableModel data)
           
 void createRangeAxis(ChartDocumentContext chartDocContext, ChartTableModel data, org.jfree.chart.JFreeChart chart)
          Create range axis for the current chart and update the chart object with it.
 Integer[] getColumPositions(ChartDocumentContext chartDocContext, ChartElement axisElement, AxisSeriesLinkInfo axisSeriesLinkInfo)
          Returns custom dataset based on certain column positions.
 Paint getPaintFromSeries(ChartElement seriesElement)
          This method checks to see if there is a gradient type other than "none" set on seriesElement.
 org.jfree.chart.plot.PlotOrientation getPlotOrientation(ChartDocument chartDocument)
          Returns the plot orientation (horizontal or vertical) for the current chart.
static boolean getShowLegend(ChartDocument chartDocument)
           
static boolean getShowToolTips(ChartDocument chartDocument)
          Returns a boolean value that indicates if the chart should generate tooltips
static String getTitle(ChartDocument chartDocument)
          Gets the title of the chart defined in the chartDocument
static String getValueAxisLabel(ChartDocument chartDocument)
          Returns the ValueAxisLabel of the chart.
static String getValueCategoryLabel(ChartDocument chartDocument)
          Returns the ValueCategoryLabel of the chart.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JFreeChartGenerator

public JFreeChartGenerator()
Method Detail

getTitle

public static String getTitle(ChartDocument chartDocument)
Gets the title of the chart defined in the chartDocument

Parameters:
chartDocument - - ChartDocument that defines what the series should look like
Returns:
String - the title

getShowToolTips

public static boolean getShowToolTips(ChartDocument chartDocument)
Returns a boolean value that indicates if the chart should generate tooltips

Parameters:
chartDocument - - ChartDocument that defines what the series should look like
Returns:
true if we want to show tool tips

getValueCategoryLabel

public static String getValueCategoryLabel(ChartDocument chartDocument)
Returns the ValueCategoryLabel of the chart.

Parameters:
chartDocument - - ChartDocument that defines what the series should look like
Returns:
String - the value category label

getValueAxisLabel

public static String getValueAxisLabel(ChartDocument chartDocument)
Returns the ValueAxisLabel of the chart.

Parameters:
chartDocument - - ChartDocument that defines what the series should look like
Returns:
String - the value axis label

getShowLegend

public static boolean getShowLegend(ChartDocument chartDocument)
Parameters:
chartDocument - - ChartDocument that defines what the series should look like
Returns:
a boolean that indicates of if a legend should be included in the chart

getPlotOrientation

public org.jfree.chart.plot.PlotOrientation getPlotOrientation(ChartDocument chartDocument)
Returns the plot orientation (horizontal or vertical) for the current chart.

Parameters:
chartDocument - that contains a orientation on the Plot element
Returns:
PlotOrientation.VERTICAL or .HORIZONTAL or Null if not defined.

getColumPositions

public Integer[] getColumPositions(ChartDocumentContext chartDocContext,
                                   ChartElement axisElement,
                                   AxisSeriesLinkInfo axisSeriesLinkInfo)
Returns custom dataset based on certain column positions. The column positions are retrieved by iterating over series elements looking for a specific/given axis id.

Parameters:
chartDocContext - Chart document context object for the current chart document.
axisElement - Current axis element.
axisSeriesLinkInfo - Holds information that links the axis id to series element(s).
Returns:
DefaultCategoryDataset that has information from specific column positions.

createRangeAxis

public void createRangeAxis(ChartDocumentContext chartDocContext,
                            ChartTableModel data,
                            org.jfree.chart.JFreeChart chart)
Create range axis for the current chart and update the chart object with it.

Parameters:
chartDocContext - Chart documument context for the current chart.
data - Data for the current chart.
chart - The chart object to be updated with range axis info.

getPaintFromSeries

public Paint getPaintFromSeries(ChartElement seriesElement)
This method checks to see if there is a gradient type other than "none" set on seriesElement. If the series element has a gradient set on it then it returns that. Otherwise if a color is defined then that is returned. If no color or gradient is set then this method returns a null

Parameters:
seriesElement - - Current series element
Returns:
a Paint object defined by the seriesElement

createChart

public org.jfree.chart.JFreeChart createChart(ChartDocumentContext chartDocContext,
                                              ChartTableModel data)
Specified by:
createChart in interface IJFreeChartGenerator