org.pentaho.chart.plugin.jfreechart.utils
Class JFreeChartUtils

java.lang.Object
  extended by org.pentaho.chart.ChartUtils
      extended by org.pentaho.chart.plugin.jfreechart.utils.JFreeChartUtils

public class JFreeChartUtils
extends ChartUtils

Author:
wseyler

Method Summary
static org.jfree.data.KeyToGroupMap createKeyToGroupMap(ChartDocument chartDocument, ChartTableModel data, org.jfree.data.category.CategoryDataset dataSet)
           
static ChartElement getBaseStackedGroupElement(ChartDocument chartDocument)
           
static ChartElement getChildGroup(ChartElement parentGroup)
           
static Color getColorFromCSSValue(org.pentaho.reporting.libraries.css.values.CSSValue value)
          Retrieves the color information from the CSSValue parameter, creates a Color object and returns the same.
static String getColumnName(ChartTableModel data, int column)
           
static GradientPaint getGradientPaint(ChartElement ce)
          Creates a GradientPaint object from the current series element using the gradient pertinent information.
static boolean getIsStackedGrouped(ChartDocument chartDocument)
           
static float getMaximumBarWidth(ChartElement seriesElement)
          Controls what the maximum bar width can be.
static Object getRawRowName(ChartTableModel data, ChartDocument chartDocument, int row)
           
static double getScale(ChartDocument chartDocument)
          Get the scale of the chart from the ChartTableModel.
static int getSeriesColumn(ChartElement seriesElement, ChartTableModel data, int columnDefault)
           
static int getSeriesRow(ChartElement seriesElement, int rowDefault)
           
static boolean getShowUrls(ChartDocument chartDocument)
          If the chart URL template is defined in the plot tag with url value, then return true.
static org.jfree.ui.StandardGradientPaintTransformer getStandardGradientPaintTrans(ChartElement ce)
          Returns a new StandardGradientPaintTransformer object if the series element has gradient type of horizontal, vertical, center-horizontal and center-vertical.
static String getURLText(ChartDocument chartDocument)
           
static void setPlotAttributes(org.jfree.chart.plot.CategoryPlot categoryPlot, ChartDocument chartDocument)
          Main method for setting ALL the plot attributes.
static void setURLGeneration(org.jfree.chart.renderer.category.CategoryItemRenderer renderer, ChartDocument chartDocument)
           
static boolean showItemLabel(ChartElement element)
          Returns true if the item label visibility is set to true for the given element
 
Methods inherited from class org.pentaho.chart.ChartUtils
getFont, getFont, getFontFamily, getFontSize, getFontStyle, getFontWeight
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRawRowName

public static Object getRawRowName(ChartTableModel data,
                                   ChartDocument chartDocument,
                                   int row)

getColumnName

public static String getColumnName(ChartTableModel data,
                                   int column)
Parameters:
data -
column -
Returns:

getScale

public static double getScale(ChartDocument chartDocument)
Get the scale of the chart from the ChartTableModel.

Parameters:
chartDocument - Contains actual chart definition
Returns:
Returns the scale for the current plot

getSeriesColumn

public static int getSeriesColumn(ChartElement seriesElement,
                                  ChartTableModel data,
                                  int columnDefault)
Parameters:
seriesElement - - series definition that has column-pos or column-name style
data - - the actual data (needed to locate the correct columns)
columnDefault - - default column to return if either column-pos or column-name are not defined or not found
Returns:
int value of the real column in the data.

getSeriesRow

public static int getSeriesRow(ChartElement seriesElement,
                               int rowDefault)
Parameters:
seriesElement - - series definition that has column-pos or column-name style
rowDefault - - default column to return if either column-pos or column-name are not defined or not found
Returns:
int value of the real column in the data.

getShowUrls

public static boolean getShowUrls(ChartDocument chartDocument)
If the chart URL template is defined in the plot tag with url value, then return true. False otherwise.

Parameters:
chartDocument - - ChartDocument that defines what the series should look like
Returns:
true if chart url templates are defined in the plot tag with url value.

setPlotAttributes

public static void setPlotAttributes(org.jfree.chart.plot.CategoryPlot categoryPlot,
                                     ChartDocument chartDocument)
Main method for setting ALL the plot attributes. This method is a staging method for calling all the other helper methods.

Parameters:
categoryPlot - - a CategoryPlot to manipulate
chartDocument - - ChartDocument that contains the information for manipulating the plot

setURLGeneration

public static void setURLGeneration(org.jfree.chart.renderer.category.CategoryItemRenderer renderer,
                                    ChartDocument chartDocument)
Parameters:
renderer - - Renderer for the current chart
chartDocument - - ChartDocument that defines what the series should look like

getURLText

public static String getURLText(ChartDocument chartDocument)
Parameters:
chartDocument - - ChartDocument that defines what the series should look like
Returns:
URL text

getGradientPaint

public static GradientPaint getGradientPaint(ChartElement ce)
Creates a GradientPaint object from the current series element using the gradient pertinent information.

The gradient paint contains color and start and end co-ordinates for the gradient. If the gradient type is not none and not points, then the gradient paint simply contains color information.

If the required information from the chart element was not available then returns a null.

Parameters:
ce - The ChartElement to be used to create the GradientPaint object.
Returns:
GradientPaint Returns the newly created GradientPaint object.

getColorFromCSSValue

public static Color getColorFromCSSValue(org.pentaho.reporting.libraries.css.values.CSSValue value)
Retrieves the color information from the CSSValue parameter, creates a Color object and returns the same.

Parameters:
value - CSSValue that has the color information.
Returns:
Color Returns a Color object created from the color information in the value parameter If the CSSValue does not contain any color information then returns a null.

getStandardGradientPaintTrans

public static org.jfree.ui.StandardGradientPaintTransformer getStandardGradientPaintTrans(ChartElement ce)
Returns a new StandardGradientPaintTransformer object if the series element has gradient type of horizontal, vertical, center-horizontal and center-vertical.

Parameters:
ce - Current series element
Returns:
StandardGradientPaintTransformer New StandardGradientPaintTransformer with appropriate gradient paint transform type.

showItemLabel

public static boolean showItemLabel(ChartElement element)
Returns true if the item label visibility is set to true for the given element

Parameters:
element - Current series element.
Returns:
true/false

getMaximumBarWidth

public static float getMaximumBarWidth(ChartElement seriesElement)
Controls what the maximum bar width can be.

Parameters:
seriesElement - Maximum bar width setting for current series element
Returns:
Returns the current maximum bar width setting

getBaseStackedGroupElement

public static ChartElement getBaseStackedGroupElement(ChartDocument chartDocument)

getChildGroup

public static ChartElement getChildGroup(ChartElement parentGroup)

getIsStackedGrouped

public static boolean getIsStackedGrouped(ChartDocument chartDocument)
Parameters:
chartDocument -
Returns:

createKeyToGroupMap

public static org.jfree.data.KeyToGroupMap createKeyToGroupMap(ChartDocument chartDocument,
                                                               ChartTableModel data,
                                                               org.jfree.data.category.CategoryDataset dataSet)
Parameters:
chartDocument -
data -
Returns: