Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Here is an example of specifying your chart properties as an input string. You of course can also derive this string in a prior action, say, possibly a JavaScript rule.

Code Block
xml
xml
borderStylesolidxml
<inputs>
    <attributes type="string">
      <sources>
        <request>attributes</request>
      </sources>
      <default-value>

      <![CDATA[

      <chart-attributes>
          <chart-type>BarChart</chart-type>
          <border-visible>false</border-visible>
          <is-clickable>false</is-clickable>
          <include-legend>true</include-legend>

          ... more chart attributes here ...

      </chart-attributes>

      ]]>

      </default-value>
    </attributes>
  </inputs>

   ...

  <action-definition>
      <component-name>ChartComponent</component-name>
      <action-type>Bar Chart</action-type>
      <action-inputs>
        <chart-data type="result-set" mapping="query_result"/>
        *<chart-attributes type="string" mapping="attributes"/>*
      </action-inputs>

   ...

...

The action sequence XML for this looks similar to below:

Code Block
xml
xml
borderStylesolidxml
<resources>
    <chart_resource>
      <solution-file>
        <location>testchart.xml</location>
        <mime-type>text/xml</mime-type>
      </solution-file>
    </chart_resource>
  </resources>

  <actions>

   ...

    <action-definition>
      <component-name>ChartComponent</component-name>
      <action-type>Bar Chart</action-type>
       ...
      <action-resources>
        <chart-attributes type="resource" mapping="chart_resource"/>
      </action-resources>

   ...

...

Chart attributes described in-line in the component definition look similar to this:

Code Block
xml
xml
borderStylesolidxml
<action-definition>
      <component-name>ChartComponent</component-name>
      <action-type>Bar Line Chart</action-type>

       ...

      <component-definition>
        <chart-attributes>
          <chart-type>BarLineChart</chart-type>
          <border-visible>true</border-visible>
          <include-legend>false</include-legend>
          <is-3D>false</is-3D>
          <markers-visible>false</markers-visible>

          ... more chart attributes here ...

        </chart-attributes>
      </component-definition>
    </action-definition>

...

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

Code Block
xml
xml
titleSample Chart.xactionxml
<action-sequence>
  <name>Chart.xaction</name>
  <title>Default Title</title>
  <version>1</version>
  <logging-level>DEBUG</logging-level>
  <documentation>
    <author>William E. Seyler</author>
    <description>Default Description</description>
    <icon>JFree-quadrant-budget-hsql.png</icon>
    <help>Help</help>
    <result-type>rule</result-type>
  </documentation>
  <inputs>
    <chart-type type="string">
      <default-value>.png</default-value>
      <sources>
        <request>type</request>
      </sources>
    </chart-type>
  </inputs>
  <actions>
    <action-definition>
      <action-outputs>
        <result-set type="list" />
      </action-outputs>
      <component-name>SQLLookupRule</component-name>
      <action-type>rule</action-type>
      <component-definition>
        <source>sql</source>
        <live>true</live>
        <jndi>SampleData</jndi>
        <query>
          <![CDATA[select QUADRANT_ACTUALS.REGION, QUADRANT_ACTUALS.DEPARTMENT,
            QUADRANT_ACTUALS.POSITIONTITLE, QUADRANT_ACTUALS.ACTUAL, QUADRANT_ACTUALS.BUDGET
            from QUADRANT_ACTUALS order by QUADRANT_ACTUALS.REGION,QUADRANT_ACTUALS.DEPARTMENT]]>
        </query>
      </component-definition>
      </action-definition>
      <action-definition>
        <action-inputs>
          <output-type type="string" mapping="chart-type" />
          <result-output type="file" />
          <chart-data type="list" mapping="result-set" />
        </action-inputs>
      <action-outputs>
        <chart-output type="string" />
        <base-url type="string" />
      </action-outputs>
      <component-name>ChartComponent</component-name>
      <action-type>report</action-type>
      <component-definition>
        <by-row>false</by-row>
        <chart-attributes>
          <chart-type>PieChart</chart-type>
          <title>Actual vs Budget by Region</title>
          <title-position>TOP</title-position>
          <title-font>
            <font-family>Serif</font-family>
            <size>36</size>
            <is-bold>false</is-bold>
            <is-italic>false</is-italic>
          </title-font>
          <range-title>US Dollars</range-title>
          <chart-background type="color">#FFFFFF</chart-background>
          <plot-background type="color">#FF0000</plot-background>
          <orientation>Horizontal</orientation>
          <height>400</height>
          <width>800</width>
          <is-3D>true</is-3D>
          <is-stacked>false</is-stacked>
          <category-label-rotation>90</category-label-rotation>
          <border-visible>false</border-visible>
          <border-paint>#3399FF</border-paint>
          <include-legend>true</include-legend>
        </chart-attributes>
      </component-definition>
    </action-definition>
  </actions>
</action-sequence>

...