Class ChartAction
java.lang.Object
org.pentaho.platform.plugin.action.chartbeans.ChartAction
- All Implemented Interfaces:
org.pentaho.platform.api.action.IAction
,org.pentaho.platform.api.action.IStreamingAction
This class was adapted from
ChartComponent
by cboyden
This is a bean that permits easy access to the ChartBeans functionality and was specifically designed to be run from
within the Pentaho Platform as an Action Sequence Action.- Author:
- cboyden, aphillips
-
Field Summary
Modifier and TypeFieldDescriptionprotected Exception
protected int
protected String
protected OutputStream
protected org.pentaho.commons.connection.IPentahoResultSet
protected String
protected int
protected org.pentaho.chart.model.ChartModel
protected String
protected String
protected int
protected String
protected boolean
protected static final int
protected static final int
protected String
protected Number
protected int
protected String
protected String
protected int
protected String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
Called to process the chart definition and data set to produce a usable chart.Get the chart engine that the resulting chart was created throughboolean
getMimeType
(String streamPropertyName) protected org.pentaho.chart.plugin.api.IOutput.OutputTypes
Fetch the desired output typeprotected void
Sets the chart engine based on the order of precedence: 1) Chart Definition 2) Action Sequence 3) System Setting 4) Hard Codedprotected void
protected Object[][]
processChartData
(org.pentaho.commons.connection.IPentahoResultSet resultSet, int valueColumnIndex) Transform the IPentahoResultSet into the data format suitable for chart creation.void
setCategoryColumn
(String categoryCol) Define the column in the data set that contains the Category datavoid
setChartContentStream
(OutputStream outStream) Define the OutputStream to which the resulting chart shall be writtenvoid
setChartData
(org.pentaho.commons.connection.IPentahoResultSet chartDataSet) Define the data set that will populate the chartvoid
setChartEngine
(String chartEngine) Set the chart engine to render the chartvoid
setChartHeight
(int chartHeight) Set the height of the chart in units specific to the ChartPluginvoid
setChartHeight
(String chartHeight) Set the height of the chart in units specific to the ChartPluginvoid
setChartModel
(org.pentaho.chart.model.ChartModel chartModel) Set the ChartModelvoid
setChartModelJson
(String chartModelJson) Set the JSON representation of the ChartModelvoid
setChartModelXml
(String chartModelXml) Set the XML representation of the ChartModelvoid
setChartModelXmlStream
(InputStream chartModelStream) Set the XML representation of the ChartModel as an InputStreamvoid
setChartWidth
(int chartWidth) Set the width of the chart in units specific to the ChartPluginvoid
setChartWidth
(String chartWidth) Set the width of the chart in units specific to the ChartPluginvoid
setContentLinkingTemplate
(String template) void
setConvertNullsToZero
(boolean convert) void
setOutputStream
(OutputStream outputStream) void
setOutputType
(String outputType) void
setScalingFactor
(Double scalingFactor) void
setSeriesColumn
(String seriesCol) Define the column in the data set that contains the Series/Domain datavoid
setValueColumn
(String valueCol) Define the column in the data set that contains the Value/Range datavoid
validate()
Validate the current settings of the ChartAction.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.pentaho.platform.api.action.IAction
isExecutionSuccessful
-
Field Details
-
DEFAULT_CHART_WIDTH
protected static final int DEFAULT_CHART_WIDTH- See Also:
-
DEFAULT_CHART_HEIGHT
protected static final int DEFAULT_CHART_HEIGHT- See Also:
-
convertNullsToZero
protected boolean convertNullsToZero -
seriesColumnName
-
seriesColumn
protected int seriesColumn -
categoryColumnName
-
categoryColumn
protected int categoryColumn -
valueColumnName
-
valueColumn
protected int valueColumn -
chartData
protected org.pentaho.commons.connection.IPentahoResultSet chartData -
chartEngine
-
bootException
-
outputType
-
chartWidth
protected int chartWidth -
chartHeight
protected int chartHeight -
contentLinkingTemplate
-
scalingFactor
-
chartContentStream
-
chartModelJson
-
chartModelXml
-
chartModel
protected org.pentaho.chart.model.ChartModel chartModel -
title
-
-
Constructor Details
-
ChartAction
public ChartAction()
-
-
Method Details
-
execute
Called to process the chart definition and data set to produce a usable chart.- Specified by:
execute
in interfaceorg.pentaho.platform.api.action.IAction
- Throws:
ChartBootException
ChartProcessingException
ResourceException
InvalidChartDefinition
IOException
PersistenceException
Exception
- See Also:
-
IAction.execute()
-
setContentLinkingTemplate
-
processChartData
protected Object[][] processChartData(org.pentaho.commons.connection.IPentahoResultSet resultSet, int valueColumnIndex) Transform the IPentahoResultSet into the data format suitable for chart creation.- Returns:
- Row / Column data table or null
-
setOutputStream
- Specified by:
setOutputStream
in interfaceorg.pentaho.platform.api.action.IStreamingAction
-
setChartContentStream
Define the OutputStream to which the resulting chart shall be written- Parameters:
outStream
- Stream to receive the chart
-
setChartData
public void setChartData(org.pentaho.commons.connection.IPentahoResultSet chartDataSet) Define the data set that will populate the chart- Parameters:
chartDataSet
- data set for charting
-
validate
Validate the current settings of the ChartAction. If validate() returns true, then execute may be called. If validate() returns false, a call to execute() is guaranteed to fail.- Throws:
Exception
-
setSeriesColumn
Define the column in the data set that contains the Series/Domain data- Parameters:
seriesCol
- name of column that contains the Series/Domain for the chart
-
setConvertNullsToZero
public void setConvertNullsToZero(boolean convert) -
getConvertNullsToZero
public boolean getConvertNullsToZero() -
setCategoryColumn
Define the column in the data set that contains the Category data- Parameters:
seriesCol
- name of column that contains the Category for the chart
-
setValueColumn
Define the column in the data set that contains the Value/Range data- Parameters:
seriesCol
- name of column that contains the Value/Range for the chart
-
getOutputType
protected org.pentaho.chart.plugin.api.IOutput.OutputTypes getOutputType()Fetch the desired output type- Returns:
- output type
-
getMimeType
- Specified by:
getMimeType
in interfaceorg.pentaho.platform.api.action.IStreamingAction
-
loadChartEngine
protected void loadChartEngine()Sets the chart engine based on the order of precedence: 1) Chart Definition 2) Action Sequence 3) System Setting 4) Hard Coded -
loadChartModel
protected void loadChartModel() -
setChartModelJson
Set the JSON representation of the ChartModel- Parameters:
chartModelJson
- JSON serialized representation of the ChartModel
-
setChartModelXmlStream
Set the XML representation of the ChartModel as an InputStream- Parameters:
chartModelStream
- XML serialized representation of the ChartModel- Throws:
IOException
- if there is a problem converting the input stream to an encoded string
-
setChartModelXml
Set the XML representation of the ChartModel- Parameters:
chartStyleXml
- XML serialized representation of the ChartModel
-
setChartModel
public void setChartModel(org.pentaho.chart.model.ChartModel chartModel) Set the ChartModel- Parameters:
chartModel
- model of the chart to be generated
-
setChartWidth
public void setChartWidth(int chartWidth) Set the width of the chart in units specific to the ChartPlugin- Parameters:
chartWidth
- width of the chart
-
setChartHeight
public void setChartHeight(int chartHeight) Set the height of the chart in units specific to the ChartPlugin- Parameters:
chartHeight
- height of the chart
-
setChartWidth
Set the width of the chart in units specific to the ChartPlugin- Parameters:
chartWidth
- width of the chart
-
setChartHeight
Set the height of the chart in units specific to the ChartPlugin- Parameters:
chartHeight
- height of the chart
-
getChartEngine
Get the chart engine that the resulting chart was created through- Returns:
-
setChartEngine
Set the chart engine to render the chart- Parameters:
chartEngine
- Value of "JFreeChart" or "OpenFlashChart"
-
setOutputType
-
setScalingFactor
-
getSwfPath
-
getSwfName
-