PieChartReport.jrxml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <jasperReport name="PieChartReport" language="java" columnCount="2" pageWidth="595" pageHeight="842" columnWidth="270" columnSpacing="15" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30" uuid="166628aa-90af-4c8f-a71b-2eaadee2f0e1">
  2. <style name="Sans_Normal" default="true" fontName="DejaVu Sans" fontSize="8.0" bold="false" italic="false" underline="false" strikeThrough="false"/>
  3. <style name="Sans_Bold" fontName="DejaVu Sans" fontSize="8.0" bold="true" italic="false" underline="false" strikeThrough="false"/>
  4. <style name="Sans_Italic" fontName="DejaVu Sans" fontSize="8.0" bold="false" italic="true" underline="false" strikeThrough="false"/>
  5. <style name="Serif_Normal" fontName="DejaVu Serif" fontSize="10.0" bold="false" italic="false" underline="false" strikeThrough="false"/>
  6. <style name="Serif_Bold" fontName="DejaVu Serif" fontSize="10.0" bold="true" italic="false" underline="false" strikeThrough="false"/>
  7. <parameter name="ReportTitle" class="java.lang.String"/>
  8. <parameter name="MaxOrderID" class="java.lang.Integer"/>
  9. <query language="sql"><![CDATA[SELECT * FROM Orders WHERE OrderID <= $P{MaxOrderID} ORDER BY ShipCountry]]></query>
  10. <field name="ShippedDate" class="java.sql.Timestamp"/>
  11. <field name="ShipCountry" class="java.lang.String"/>
  12. <field name="RequiredDate" class="java.sql.Timestamp"/>
  13. <field name="CustomerID" class="java.lang.String"/>
  14. <field name="OrderID" class="java.lang.Integer"/>
  15. <field name="ShipName" class="java.lang.String"/>
  16. <field name="ShipVia" class="java.lang.Integer"/>
  17. <field name="ShipPostalCode" class="java.lang.String"/>
  18. <field name="OrderDate" class="java.sql.Timestamp"/>
  19. <field name="ShipCity" class="java.lang.String"/>
  20. <field name="ShipAddress" class="java.lang.String"/>
  21. <field name="EmployeeID" class="java.lang.Integer"/>
  22. <field name="ShipRegion" class="java.lang.String"/>
  23. <field name="Freight" class="java.lang.Double"/>
  24. <variable name="FirstLetter" resetType="None" class="java.lang.String">
  25. <expression><![CDATA[$F{ShipCountry}.substring(0, 1).toUpperCase()]]></expression>
  26. </variable>
  27. <variable name="FirstLetterCount" resetType="Group" incrementType="Group" calculation="Count" resetGroup="ChartGroup" incrementGroup="FirstLetterGroup" class="java.lang.Integer">
  28. <expression><![CDATA[Boolean.TRUE]]></expression>
  29. </variable>
  30. <variable name="FirstLetterMin" resetType="Group" calculation="Lowest" resetGroup="ChartGroup" class="java.lang.String">
  31. <expression><![CDATA[$V{FirstLetter}]]></expression>
  32. </variable>
  33. <variable name="FirstLetterMax" resetType="Group" calculation="Highest" resetGroup="ChartGroup" class="java.lang.String">
  34. <expression><![CDATA[$V{FirstLetter}]]></expression>
  35. </variable>
  36. <variable name="FreightSumChartGroup" resetType="Group" calculation="Sum" resetGroup="ChartGroup" class="java.lang.Double">
  37. <expression><![CDATA[$F{Freight}]]></expression>
  38. </variable>
  39. <variable name="FreightSumCountryGroup" resetType="Group" calculation="Sum" resetGroup="CountryGroup" class="java.lang.Double">
  40. <expression><![CDATA[$F{Freight}]]></expression>
  41. </variable>
  42. <variable name="FreightSumColumn" resetType="Column" calculation="Sum" class="java.lang.Double">
  43. <expression><![CDATA[$F{Freight}]]></expression>
  44. </variable>
  45. <variable name="FreightSumPage" resetType="Page" calculation="Sum" class="java.lang.Double">
  46. <expression><![CDATA[$F{Freight}]]></expression>
  47. </variable>
  48. <variable name="FreightSumReport" calculation="Sum" class="java.lang.Double">
  49. <expression><![CDATA[$F{Freight}]]></expression>
  50. </variable>
  51. <variable name="DateHighestCountryGroup" resetType="Group" calculation="Highest" resetGroup="CountryGroup" class="java.sql.Timestamp">
  52. <expression><![CDATA[$F{OrderDate}]]></expression>
  53. </variable>
  54. <variable name="RegionCountCountryGroup" resetType="Group" calculation="Count" resetGroup="CountryGroup" class="java.lang.Integer">
  55. <expression><![CDATA[$F{ShipRegion}]]></expression>
  56. </variable>
  57. <group name="ChartGroup" minHeightToStartNewPage="200" startNewColumn="true">
  58. <expression><![CDATA[($V{FirstLetterCount} - 1) / 3]]></expression>
  59. <groupHeader>
  60. <band height="250">
  61. <element kind="rectangle" uuid="3ecfb716-1ae4-42d5-a6b6-ad4c99944ebf" x="0" y="14" width="270" height="11" forecolor="#FFDDDD" backcolor="#FFDDDD"/>
  62. <element kind="staticText" uuid="59abbdd0-29d2-4c98-b983-f35db84ade78" mode="Opaque" x="0" y="14" width="130" height="11" forecolor="#FF0000" backcolor="#FFDDDD" underline="true" style="Sans_Italic">
  63. <text><![CDATA[Countries Starting With Letter :]]></text>
  64. </element>
  65. <element kind="textField" uuid="859fc8d2-b3c5-4cc5-8dbc-1d52fed74657" mode="Opaque" x="130" y="14" width="20" height="11" forecolor="#FF0000" backcolor="#FFDDDD" evaluationTime="Group" evaluationGroup="ChartGroup" hTextAlign="Right" style="Sans_Bold">
  66. <expression><![CDATA[$V{FirstLetterMin}]]></expression>
  67. </element>
  68. <element kind="staticText" uuid="5516c71a-79f0-4b28-b3c4-bec58d2d23e0" mode="Opaque" x="150" y="14" width="20" height="11" forecolor="#FF0000" backcolor="#FFDDDD" underline="true" hTextAlign="Center" style="Sans_Italic">
  69. <text><![CDATA[to]]></text>
  70. </element>
  71. <element kind="textField" uuid="538685ce-3ecc-462d-8032-03cf54dd0f50" mode="Opaque" x="170" y="14" width="20" height="11" forecolor="#FF0000" backcolor="#FFDDDD" evaluationTime="Group" evaluationGroup="ChartGroup" style="Sans_Bold">
  72. <expression><![CDATA[$V{FirstLetterMax}]]></expression>
  73. </element>
  74. <element kind="chart" chartType="pie" uuid="a63b38fe-68ce-4bb0-ac09-2735d8a78406" positionType="Float" x="0" y="50" width="270" height="175" evaluationTime="Group" evaluationGroup="ChartGroup">
  75. <dataset kind="pie" incrementType="Group" resetGroup="ChartGroup" incrementGroup="CountryGroup" resetType="Group">
  76. <series>
  77. <keyExpression><![CDATA[$F{ShipCountry}]]></keyExpression>
  78. <valueExpression><![CDATA[$V{FreightSumCountryGroup}]]></valueExpression>
  79. <sectionHyperlink linkType="Reference" linkTarget="Blank">
  80. <hyperlinkReferenceExpression><![CDATA["http://en.wikipedia.org/wiki/" + $F{ShipCountry}]]></hyperlinkReferenceExpression>
  81. <hyperlinkTooltipExpression><![CDATA["Read more about " + $F{ShipCountry}]]></hyperlinkTooltipExpression>
  82. </sectionHyperlink>
  83. </series>
  84. </dataset>
  85. <plot labelFormat="{0} {2}" legendLabelFormat="{0} {1}">
  86. <itemLabel color="#000000" backgroundColor="#FFFFFF"/>
  87. </plot>
  88. </element>
  89. </band>
  90. </groupHeader>
  91. <groupFooter>
  92. <band height="25">
  93. <element kind="line" uuid="986dd370-4c74-4af8-9d75-f9d7da1407b4" x="0" y="0" width="270" height="1" forecolor="#FF0000"/>
  94. <element kind="staticText" uuid="025dc667-6992-4d06-a547-377e13a8d1f6" x="0" y="1" width="45" height="11" forecolor="#FF0000" hTextAlign="Right" style="Sans_Bold">
  95. <text><![CDATA[Count :]]></text>
  96. </element>
  97. <element kind="textField" uuid="b27cb487-36f9-483a-9fc9-e97e66493a91" x="45" y="1" width="25" height="11" forecolor="#FF0000" hTextAlign="Right" style="Sans_Bold">
  98. <expression><![CDATA[$V{ChartGroup_COUNT}]]></expression>
  99. </element>
  100. <element kind="staticText" uuid="8234e970-f182-459a-9c85-28ba31a057cf" x="70" y="1" width="140" height="11" forecolor="#FF0000" hTextAlign="Right" style="Sans_Bold">
  101. <text><![CDATA[Total :]]></text>
  102. </element>
  103. <element kind="textField" uuid="4a88c465-65f6-49c1-8c25-45990c55d2e7" x="210" y="1" width="60" height="11" forecolor="#FF0000" pattern="0.00" hTextAlign="Right" style="Sans_Bold">
  104. <expression><![CDATA[$V{FreightSumChartGroup}]]></expression>
  105. </element>
  106. </band>
  107. </groupFooter>
  108. </group>
  109. <group name="FirstLetterGroup">
  110. <expression><![CDATA[$V{FirstLetter}]]></expression>
  111. </group>
  112. <group name="CountryGroup">
  113. <expression><![CDATA[$F{ShipCountry}]]></expression>
  114. <groupHeader>
  115. <band height="15">
  116. <element kind="line" uuid="db896bfd-f674-443f-a52c-5fe24bf390c2" x="0" y="14" width="270" height="1"/>
  117. <element kind="textField" uuid="2e9d40c7-3d6f-4db9-839d-eed85965496d" x="10" y="2" width="150" height="11" style="Sans_Bold">
  118. <expression><![CDATA[$F{ShipCountry}]]></expression>
  119. </element>
  120. <element kind="textField" uuid="98ec3108-d055-4788-9dc6-16bcd2d4204c" x="170" y="2" width="100" height="11" evaluationTime="Group" pattern="EEE, MMM d, yyyy" evaluationGroup="CountryGroup" hTextAlign="Right" style="Sans_Bold">
  121. <expression><![CDATA[$V{DateHighestCountryGroup}]]></expression>
  122. </element>
  123. </band>
  124. </groupHeader>
  125. <groupFooter>
  126. <band height="15">
  127. <element kind="rectangle" uuid="a0573d1d-8c83-4e17-b2bf-1dc306bfb4cf" x="0" y="0" width="270" height="11" forecolor="#C0C0C0" backcolor="#C0C0C0"/>
  128. <element kind="staticText" uuid="ea12ba40-9bc8-4f9e-a8a8-a1f1d279a8a8" mode="Opaque" x="0" y="0" width="45" height="11" backcolor="#C0C0C0" hTextAlign="Right" style="Sans_Bold">
  129. <text><![CDATA[Count :]]></text>
  130. </element>
  131. <element kind="textField" uuid="51a48b2c-1769-4a7f-b921-49ca6e859bdf" mode="Opaque" x="45" y="0" width="25" height="11" backcolor="#C0C0C0" hTextAlign="Right" style="Sans_Bold">
  132. <expression><![CDATA[$V{CountryGroup_COUNT}]]></expression>
  133. </element>
  134. <element kind="staticText" uuid="d69c36fb-5b5a-4d0e-8b7a-b96caabe9b3c" mode="Opaque" x="70" y="0" width="140" height="11" backcolor="#C0C0C0" hTextAlign="Right" style="Sans_Bold">
  135. <text><![CDATA[Total :]]></text>
  136. </element>
  137. <element kind="textField" uuid="7bfddd2f-193f-4767-bb2f-1652c84ea4cb" mode="Opaque" x="210" y="0" width="60" height="11" backcolor="#C0C0C0" pattern="0.00" hTextAlign="Right" style="Sans_Bold">
  138. <expression><![CDATA[$V{FreightSumCountryGroup}]]></expression>
  139. </element>
  140. </band>
  141. </groupFooter>
  142. </group>
  143. <title height="50">
  144. <element kind="elementGroup"/>
  145. <element kind="staticText" uuid="f06713e8-e1f1-4dad-a5db-8721c65ac588" x="0" y="0" width="555" height="35" fontSize="22.0" hTextAlign="Center" style="Serif_Bold">
  146. <text><![CDATA[Pie Chart Report]]></text>
  147. <box style="Serif_Bold">
  148. <topPen lineWidth="0.5"/>
  149. </box>
  150. </element>
  151. </title>
  152. <columnHeader height="11">
  153. <element kind="rectangle" uuid="4a65b0e7-80e3-4af2-9e44-9172b5ba5c5b" x="0" y="0" width="270" height="11" backcolor="#333333"/>
  154. <element kind="staticText" uuid="9a105a7f-865d-43c7-a03b-7263c8c9a311" mode="Opaque" x="0" y="0" width="40" height="11" forecolor="#FFFFFF" backcolor="#333333" hTextAlign="Center" style="Sans_Bold">
  155. <text><![CDATA[Order]]></text>
  156. </element>
  157. <element kind="staticText" uuid="0debf846-c7a1-4978-97bc-00f5e65ec68b" mode="Opaque" x="40" y="0" width="145" height="11" forecolor="#FFFFFF" backcolor="#333333" hTextAlign="Center" style="Sans_Bold">
  158. <text><![CDATA[Name, City]]></text>
  159. </element>
  160. <element kind="staticText" uuid="c43d8968-62f5-45cd-8db7-4fe243cf6999" mode="Opaque" x="185" y="0" width="50" height="11" forecolor="#FFFFFF" backcolor="#333333" style="Sans_Bold">
  161. <text><![CDATA[Date]]></text>
  162. </element>
  163. <element kind="staticText" uuid="79da0493-a21d-439f-9e7e-902830dc9b82" mode="Opaque" x="235" y="0" width="35" height="11" forecolor="#FFFFFF" backcolor="#333333" hTextAlign="Right" style="Sans_Bold">
  164. <text><![CDATA[Freight]]></text>
  165. </element>
  166. </columnHeader>
  167. <detail>
  168. <band height="13">
  169. <element kind="textField" uuid="e5ec0153-91b8-4f00-9376-8c628cb9aed7" x="1" y="0" width="35" height="11" hTextAlign="Right">
  170. <expression><![CDATA[$F{OrderID}]]></expression>
  171. </element>
  172. <element kind="textField" uuid="02a3be78-70b0-422f-81d1-fd3ef5b99878" positionType="Float" x="40" y="0" width="110" height="11" textAdjust="StretchHeight">
  173. <expression><![CDATA[$F{ShipName} + ", " + $F{ShipCity}]]></expression>
  174. </element>
  175. <element kind="textField" uuid="978631ec-a8dd-493e-bbef-b4807e240d4b" x="155" y="0" width="25" height="11" blankWhenNull="true">
  176. <expression><![CDATA[$F{ShipRegion}]]></expression>
  177. </element>
  178. <element kind="textField" uuid="f423ee94-70d7-4b9a-a90d-9c6fefbf6ecd" x="185" y="0" width="50" height="11" pattern="dd/MM/yyyy">
  179. <expression><![CDATA[$F{OrderDate}]]></expression>
  180. </element>
  181. <element kind="textField" uuid="fbb073bd-2aab-4038-acdf-d8791274356d" x="235" y="0" width="35" height="11" pattern="0.00" hTextAlign="Right">
  182. <expression><![CDATA[$F{Freight}]]></expression>
  183. </element>
  184. <element kind="line" uuid="c7f7750f-6d8d-422b-851c-febff2c2bb58" positionType="Float" x="0" y="12" width="270" height="1" forecolor="#808080">
  185. <pen lineWidth="0.5"/>
  186. </element>
  187. </band>
  188. </detail>
  189. <columnFooter height="11">
  190. <element kind="rectangle" uuid="d4156620-50bd-4848-aea6-9941eaa6b2c2" x="0" y="0" width="270" height="11" backcolor="#333333"/>
  191. <element kind="staticText" uuid="04ad8cd5-334b-47fa-861a-a6c09ed60b0d" mode="Opaque" x="0" y="0" width="45" height="11" forecolor="#FFFFFF" backcolor="#333333" hTextAlign="Right" style="Sans_Bold">
  192. <text><![CDATA[Count :]]></text>
  193. </element>
  194. <element kind="textField" uuid="a71248a9-46f4-43bb-934a-1daaf65c4ed3" mode="Opaque" x="45" y="0" width="25" height="11" forecolor="#FFFFFF" backcolor="#333333" hTextAlign="Right" style="Sans_Bold">
  195. <expression><![CDATA[$V{COLUMN_COUNT}]]></expression>
  196. </element>
  197. <element kind="staticText" uuid="f890a596-b1ed-45d0-92ab-d7810076d5ce" mode="Opaque" x="70" y="0" width="140" height="11" forecolor="#FFFFFF" backcolor="#333333" hTextAlign="Right" style="Sans_Bold">
  198. <text><![CDATA[Total :]]></text>
  199. </element>
  200. <element kind="textField" uuid="cd2a4a6e-ec39-42b5-97da-d39cf4fba351" mode="Opaque" x="210" y="0" width="60" height="11" forecolor="#FFFFFF" backcolor="#333333" pattern="0.00" hTextAlign="Right" style="Sans_Bold">
  201. <expression><![CDATA[$V{FreightSumColumn}]]></expression>
  202. </element>
  203. </columnFooter>
  204. <pageFooter height="30">
  205. <element kind="rectangle" uuid="546d4863-ff95-4db9-8607-b1ba97b708fd" mode="Transparent" x="0" y="5" width="555" height="25"/>
  206. <element kind="staticText" uuid="1eb77597-c859-416d-9d7a-cb0f5a13627e" x="5" y="10" width="50" height="20" fontSize="14.0" hTextAlign="Right">
  207. <text><![CDATA[Count :]]></text>
  208. </element>
  209. <element kind="textField" uuid="74abc4d9-d951-48b9-826c-18c1955ae21b" x="55" y="10" width="45" height="20" fontSize="14.0" hTextAlign="Right">
  210. <expression><![CDATA[$V{PAGE_COUNT}]]></expression>
  211. </element>
  212. <element kind="staticText" uuid="07c3051b-9225-4b07-a092-84ce57bf8cf6" x="430" y="10" width="50" height="20" fontSize="14.0" hTextAlign="Right">
  213. <text><![CDATA[Total :]]></text>
  214. </element>
  215. <element kind="textField" uuid="c54af9f4-b7f4-4ab5-a366-969366845fb4" x="480" y="10" width="70" height="20" fontSize="14.0" pattern="0.00" hTextAlign="Right">
  216. <expression><![CDATA[$V{FreightSumPage}]]></expression>
  217. </element>
  218. <element kind="textField" uuid="6372ffa2-a19d-4be3-bd67-97a937f28ff3" x="200" y="10" width="75" height="20" fontSize="14.0" hTextAlign="Right">
  219. <expression><![CDATA[$V{PAGE_NUMBER}]]></expression>
  220. </element>
  221. <element kind="staticText" uuid="6f87f241-3eeb-4c1a-89a6-b2323bc6b8c9" x="275" y="10" width="5" height="20" fontSize="14.0" hTextAlign="Center">
  222. <text><![CDATA[/]]></text>
  223. </element>
  224. <element kind="textField" uuid="a9701353-2845-4eff-9d71-5f73b4666a44" x="280" y="10" width="75" height="20" fontSize="14.0" evaluationTime="Report">
  225. <expression><![CDATA[$V{PAGE_NUMBER}]]></expression>
  226. <property name="net.sf.jasperreports.export.pdf.field.type" value="Text"/>
  227. <property name="net.sf.jasperreports.print.keep.full.text" value="true"/>
  228. <propertyExpression name="net.sf.jasperreports.export.pdf.field.name"><![CDATA["PAGENUM"]]></propertyExpression>
  229. <propertyExpression name="net.sf.jasperreports.export.pdf.field.value"><![CDATA[$V{PAGE_NUMBER} + ""]]></propertyExpression>
  230. </element>
  231. </pageFooter>
  232. </jasperReport>