org.pentaho.chart.core
Class ChartDocument

java.lang.Object
  extended by org.pentaho.chart.core.ChartDocument

public class ChartDocument
extends Object

This is the object that contains the root element of the parsed chart defintion


Constructor Summary
ChartDocument(ChartElement rootElement)
          Constructor that creats the chart document.
 
Method Summary
 ChartElement[] getAxisElements()
          Provides the axis element in the given chart document.
 AxisSeriesLinkInfo getAxisSeriesLinkInfo()
          Get all the axis elements from the chart document and store it in a multi key HashMap where the key is the axis-id and "axis" tag.
 ChartElement getChartLevelElement(String tagName)
          Gets the specified element from the chart document (achart element).
 ChartElement[] getGroupChartElements()
          Creates a list of all the series ChartElements that are the children of the chart tag.
 long getModNumber()
          Returns the modification number from the root element.
 ChartElement getPlotElement()
          Provides the plot element in the given chart document.
 org.pentaho.reporting.libraries.css.values.CSSValue getPlotOrientation()
          Provides the CSSValue for Plot Orientation eg: horizontal or vertical
 org.pentaho.reporting.libraries.resourceloader.ResourceKey getResourceKey()
          Returns the ResourceKey that serves as the base location for loading relative information
 org.pentaho.reporting.libraries.resourceloader.ResourceManager getResourceManager()
          Returns the ResourceManager used to load the chart document
 ChartElement getRootElement()
          Returns the root element of the parsed chart document
 ChartElement[] getSeriesChartElements()
          Creates a list of all the series ChartElements that are the children of the chart tag.
 boolean isByRow()
          Indicates if the chart is a categorical chart.
 boolean isCategorical()
          Indicates if the chart is a categorical chart.
 void setResourceKey(org.pentaho.reporting.libraries.resourceloader.ResourceKey resourceKey)
          Sets the resource key for this chart document
 void setResourceManager(org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager)
          Sets the resource manager for this chart document
 String toString()
          Generates a string representation of the chart document
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChartDocument

public ChartDocument(ChartElement rootElement)
Constructor that creats the chart document.

Parameters:
rootElement - the parsed root element of the chart document
Method Detail

getRootElement

public ChartElement getRootElement()
Returns the root element of the parsed chart document


getResourceManager

public org.pentaho.reporting.libraries.resourceloader.ResourceManager getResourceManager()
Returns the ResourceManager used to load the chart document


getResourceKey

public org.pentaho.reporting.libraries.resourceloader.ResourceKey getResourceKey()
Returns the ResourceKey that serves as the base location for loading relative information


setResourceManager

public void setResourceManager(org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager)
Sets the resource manager for this chart document


setResourceKey

public void setResourceKey(org.pentaho.reporting.libraries.resourceloader.ResourceKey resourceKey)
Sets the resource key for this chart document


getModNumber

public long getModNumber()
Returns the modification number from the root element. This number can be used to invalidate cache information.


toString

public String toString()
Generates a string representation of the chart document

Overrides:
toString in class Object

isCategorical

public boolean isCategorical()
Indicates if the chart is a categorical chart. For this to be true, the chart element tag must have the categorical attribute set to true.


isByRow

public boolean isByRow()
Indicates if the chart is a categorical chart. For this to be true, the chart element tag must have the categorical attribute set to true.


getSeriesChartElements

public ChartElement[] getSeriesChartElements()
Creates a list of all the series ChartElements that are the children of the chart tag.

Returns:
a list of ChartElements which represent the series tags. If there are none, the list will be empty.

getGroupChartElements

public ChartElement[] getGroupChartElements()
Creates a list of all the series ChartElements that are the children of the chart tag.

Returns:
a list of ChartElements which represent the series tags. If there are none, the list will be empty.

getPlotElement

public ChartElement getPlotElement()
Provides the plot element in the given chart document. Returns null if not found.

Returns:
ChartElement Returns the plot element for the given chart document.

getAxisElements

public ChartElement[] getAxisElements()
Provides the axis element in the given chart document. Returns null if not found.

Returns:
ChartElement Returns the axis element for the given chart document.

getPlotOrientation

public org.pentaho.reporting.libraries.css.values.CSSValue getPlotOrientation()
Provides the CSSValue for Plot Orientation eg: horizontal or vertical

Returns:
CSSValue Represents the value for Plot Orientation.

getChartLevelElement

public ChartElement getChartLevelElement(String tagName)
Gets the specified element from the chart document (achart element). Returns the first occurrence of the given tag.

Parameters:
tagName - The tagName to be looked up in the chart document at one level deeper than the chart tag.
Returns:
ChartElement Returns the chart element.

getAxisSeriesLinkInfo

public AxisSeriesLinkInfo getAxisSeriesLinkInfo()
Get all the axis elements from the chart document and store it in a multi key HashMap where the key is the axis-id and "axis" tag. This is so that we can then retrieve each axis element by their id and then retrieve the individual attribute from the axis element object. We also store the series elements that refer the same axis id in an array list that can be accessed using the axis id and "series" as the key. For eg: The data structure in AxisSeriesLinkInfo looks like below: hashMap{axisID-1}{axis} = AxisElement; hashMap{axisID-1}{series} = ArrayList of SeriesElements that refer axisID-1

Returns:
AxisSeriesLinkInfo - The class that stores the axis and series information in a multi key hash map.