Flash Chart (Open Flash Chart)

Unknown macro: {scrollbar}

The Open Flash Chart Component, available in platform version 3.0 and higher, currently employs Open Flash Charts as its charting engine.

Component Name: OpenFlashChartComponent

The OpenFlashChartComponent is a BI component that can create a variety of charts including:

To successfully use this component, you will want to be familiar with the Chart Reference.

Inputs

REQUIRED INPUTS

chart-data

The dataset that you want the chart to render. Often, this is the output of a SQLLookupRule action, but can come from a number of source actions.

chart-attributes

 This defines where the xml chart definition will be resourced from.  It could come from component definition, action sequence input, or action sequence resource.
 Note: the xml chart definition specified in chart attributes also supports parameterization of elements.  This is accomplished by insterting parameter strings (i.e. {INPUT PARAM}) values in the chart xml or input. 

OPTIONAL INPUTS

The following are additional properties that you can specify for the chart as inputs, or as part of the component-definition. Many of these properties duplicate properties that you can set inside of the chart definition (chart-attributes string or XML file). When these duplicate properties are set as inputs or as part of the component-definition, they override any identical property that exists in the chart-attributes. The hierarchical nature of these properties allows you to dynamically set and override a value, yet also have a default in the chart-attributes.

by-row
Indicates if the chart data is to be aggregated along the row dimensions. Default value = false.

width
Sets the chart width in either pixels or percentages. Default value = 100%.

height
Sets the chart height in either pixes or percentages. Default value = 100%.

ofc_lib_name
Provides the ability to override the default .swf by providing the name of an alternate Open Flash Chart .swf file to use. 
Note: you should not change this unless you are a developer familiar with development of Open Flash Charts and/or Pentaho platform components.

ofc_url

Provides the ability to override the default location of the Open Flash Chart .swf file. 

Resources

OPTIONAL RESOURCES

chart_template
The "resource", usually a solution file, to use as the Chart Template. This is typically used so that you can create a file, "mychartdefinition.txt" that contains the Chart Template rather than using a string

Outputs

image-tag
Contains the image-tag of the generated open flash chart data file in the content repository. This is the ChartTemplate mashed up with the data to make the real data file to display in open flash chart.

html_fragment
Contains the HTML fragment that will render the flash chart. This includes a Flash Object fragment of size chart_height x chart_width (from inputs) and a callback location for the open flash chart data file in the content repository.

Example Action Sequence

The following action sequence uses the output from a SQL lookup rule (a Relational data source) as the input for an OpenFlashChartComponent which generates a bar chart.  See the Chart Reference for an explanation of the chart properties.

simple_chart.xaction
<?xml version="1.0" encoding="UTF-8"?>
<action-sequence>
  <name>Simple Bar Chart Example</name>
  <title>Simple Bar Chart Example</title>
  <version>1</version>
  <logging-level>DEBUG</logging-level>
  <documentation>
    <author>Jake Cornelius</author>
    <description>This demonstrates generating a simple bar chart types using the OpenFlashChartComponent in an action sequence</description>
    <icon/>
    <help/>
    <result-type/>
  </documentation>

  <inputs>
    <chart_width type="string">
      <sources>
        <request>chart_width</request>
      </sources>
      <default-value><![CDATA[650]]></default-value>
    </chart_width>
    <chart_height type="string">
      <sources>
        <request>chart_height</request>
      </sources>
      <default-value><![CDATA[400]]></default-value>
    </chart_height>
  </inputs>

  <outputs>
    <image-tag type="string"/>
  </outputs>

  <resources>
    <!-- use this section to identify any files that the component needs to execute the report -->
    <bar>
      <solution-file>
        <location>flash_barchart.xml</location>
        <mime-type>text/xml</mime-type>
      </solution-file>
    </bar>
  </resources>

  <actions>
    <action-definition>
      <component-name>SQLLookupRule</component-name>
      <action-type>Chart Data Query</action-type>
      <action-outputs>
        <query-result type="result-set" mapping="query_result"/>
      </action-outputs>
      <component-definition>
        <jndi><![CDATA[SampleData]]></jndi>
        <live><![CDATA[true]]></live>
        <query><![CDATA[SELECT PRODUCTS.PRODUCTLINE AS LINE,
            SUM(CASE ORDERFACT.YEAR_ID WHEN '2003' THEN (ORDERFACT.TOTALPRICE) ELSE 0 END) AS "2003",
            SUM(CASE ORDERFACT.YEAR_ID WHEN '2004' THEN (ORDERFACT.TOTALPRICE) ELSE 0 END) AS "2004",
            SUM(CASE ORDERFACT.YEAR_ID WHEN '2005' THEN (ORDERFACT.TOTALPRICE) ELSE 0 END) AS "2005"
          FROM
            PRODUCTS INNER JOIN ORDERFACT ON PRODUCTS.PRODUCTCODE = ORDERFACT.PRODUCTCODE
            INNER JOIN CUSTOMER_W_TER ON ORDERFACT.CUSTOMERNUMBER = CUSTOMER_W_TER.CUSTOMERNUMBER GROUP BY
            LINE
          ORDER BY
            2 DESC]]></query>
      </component-definition>
    </action-definition>

    <action-definition>
      <component-name>OpenFlashChartComponent</component-name>
      <action-type>Open Flash Chart</action-type>
      <action-inputs>
        <chart-data type="string" mapping="query_result"/>
        <width type="string" mapping="chart_width"/>
        <height type="string" mapping="chart_height"/>
      </action-inputs>
      <action-resources>
        <chart-attributes type="resource" mapping="bar"/>
      </action-resources>
      <action-outputs>
        <image-tag type="string"/>
      </action-outputs>
      <component-definition/>
    </action-definition>

  </actions>
</action-sequence>

To test this Action Sequence in your Pentaho deployment, simply:

  1. Download the attached action sequence (simple_chart.xaction) and chart xml document (flash_barchart.xml)
  2. Place them in a valid location within your solution repository (i.e. .\biserver-ce\pentaho-solutions\steel-wheels\charts)
  3. Login to the Pentaho User Console as joe/password, make sure to refresh your repository cache by selecting Tools|Reresh|Repository Cache from the menubar
  4. Navigate to the location you saved the files and open the 'Simple Bar Chart Example' action sequence: