chart.xaction 4.42 KB
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
<?xml version="1.0" encoding="UTF-8"?>
<action-sequence> 
  <name>JFree_ChartComponent.xaction</name>
  <title>%title</title>
  <version>1</version>
  <logging-level>DEBUG</logging-level>
  <documentation> 
    <author>Michael D'Amour</author>  
    <description>%description</description>  
    <icon>JFree_ChartComponent.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>  
	<customer type="string">       
	  <sources> 
        <request>customer</request> 
      </sources> 
	</customer>
  </inputs>

  <outputs>
	<chart_url type="string"/>
  </outputs>

  <resources> 
  </resources>
  
  <actions> 
    <action-definition> 
      <component-name>SQLLookupRule</component-name>
      <action-type>Query For Chart Data</action-type>
      <action-inputs> 
        <customer type="string"/>  
      </action-inputs>
      <action-outputs> 
        <query-result type="result-set" mapping="chartData"/> 
      </action-outputs>
      <component-definition> 
        <source>sql</source>  
        <live>true</live>  
        <jndi>SampleData</jndi>  
        <query> <![CDATA[
		select   DISTINCT PRODUCTLINE, SUM(QUANTITYORDERED * PRICEEACH) as "TOTAL SALES" 
		from PRODUCTS, ORDERDETAILS, CUSTOMERS, ORDERS
		where
			CUSTOMERS.CUSTOMERNUMBER = {PREPARE:customer} 
			and CUSTOMERS.CUSTOMERNUMBER = ORDERS.CUSTOMERNUMBER 
			and ORDERS.ORDERNUMBER = ORDERDETAILS.ORDERNUMBER
			and PRODUCTS.PRODUCTCODE  = ORDERDETAILS.PRODUCTCODE 
		GROUP BY PRODUCTLINE
		]]> </query> 
      </component-definition> 
    </action-definition>
  
    <action-definition> 
      <component-name>ChartComponent</component-name>
      <action-type>Create The Chart</action-type>
      <action-inputs> 
        <output-type type="string" mapping="chart-type"/>  
        <chart-data type="result-set" mapping="chartData"/> 
      </action-inputs>
      <action-outputs> 
        <chart-filename type="string"/>  
        <base-url type="string"/> 
      </action-outputs>
      <component-definition> 
        <by-row>false</by-row>  
        <height>250</height>  
        <width>300</width>  
        <title>Customer Product Mix</title>  
        <chart-attributes> 
          <chart-type>PieChart</chart-type>  
          <title-position>TOP</title-position>  
          <height></height>  
          <width></width>  
          <title></title>  
          <title-font> 
            <font-family>Tahoma</font-family>  
            <size>14</size>  
            <is-bold>false</is-bold>  
            <is-italic>false</is-italic> 
          </title-font>  
          <range-title></range-title>  
          <chart-background type="color">#e5e5e5</chart-background>  
          <plot-background type="color">#e5e5e5</plot-background>  
          <orientation>Horizontal</orientation>  
          <is-3D>false</is-3D>  
          <is-stacked>false</is-stacked>  
          <category-label-rotation>90</category-label-rotation>  
          <border-visible>false</border-visible>  
          <border-paint>#3399FF</border-paint>  
		  <display-labels>true</display-labels>
          <include-legend>true</include-legend> 
		  
		  	<color-palette>
		<color>#ee7733</color>
		<color>#9EAA36</color>
		<color>#BF0000</color>
		<color>#FCCF12</color>
		<color>#467AA9</color>
		<color>#772200</color>
		<color>#ddcc88</color>
		<color>#123D82</color>
		<color>#4A0866</color>
		<color>#445500</color>
		<color>#FFAA00</color>
		<color>#1E8AD3</color>
		<color>#AA6611</color>
		<color>#772200</color>
	</color-palette>

        </chart-attributes> 
      </component-definition> 
    </action-definition>
  
    <action-definition> 
      <component-name>JavascriptRule</component-name>
      <action-type>Get The Chart URL</action-type>
      <action-inputs> 
        <CHARTOUTPUT type="string" mapping="chart-filename"/>  
        <BASEURL type="string" mapping="base-url"/> 
      </action-inputs>
      <action-outputs> 
        <chart_url type="string"/> 
      </action-outputs>
      <component-definition> 
        <script> <![CDATA[ 
			      function getImageURL( fileName ) {
			        return '<img src="' + BASEURL + "getImage?image=" + fileName + '" />';
			      }
			    getImageURL( CHARTOUTPUT ); 
		      ]]> </script> 
      </component-definition> 
    </action-definition>
  
  </actions> 
</action-sequence>