rapthor Posted November 3, 2009 Share Posted November 3, 2009 Hello,I am new to Jasper Reports and iReports and wonder how it is possible to create a specific pie chart based on the following SQL statement: SELECT SIZE, COUNT(SIZE) AS TOTALFROM APPARTMENTGROUP BY SIZE The table APPARTMENT looks like:APPARTMENTID | SIZE------------------------1 | MEDIUM2 | MEDIUM3 | SMALL4 | LARGE5 | SMALL These are the requirements of the report I want to implement:1) There should be only ONE pie chart (no matter how many result rows are returned)2) The pie chart should display 3 slices (for the count of SMALL, MEDIUM, LARGE)3) The label of each slice should contain one of the 3 SIZE-value and its number of occurence (SMALL 2, MEDIUM 2, LARGE 1) However, when I create a report in iReport, I am inserting a pie chart and edit "Chart Data". I set "Reset Type" to "Report" and "Increment Type" to "None". The "Key Expression" is $F{SIZE}. The "Value Expression" is ${TOTAL}. The label expression is $F{SIZE} + "(" + $F{TOTAL} + ")".The result is not quite satisfying: I get a report with 3 pages, each containing a pie chart. The first pie chart contains a single slice called MEDIUM (2). The second pie chart contains two slices called MEDIUM (2) and SMALL (2). Only the last page shows the pie chart I originally wanted to create. Three slices with number of occurence.How do I restrict the result to only ONE pie chart containing ALL SIZEs and its occurence?I hope you understand my problem and can help me.Thank you in advance! Link to comment Share on other sites More sharing options...
gilclefes Posted November 4, 2009 Share Posted November 4, 2009 Read this article http://gilbertadjin.wordpress.com/2009/08/09/charting-with-jasper-reports/ it will help.Also take note of where you place the chart. It should be placed in the summary band Link to comment Share on other sites More sharing options...
rapthor Posted November 6, 2009 Author Share Posted November 6, 2009 Thank you, that helped :) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now