Top 10 biggest results chart in Ireports using Domain dataset.

So I've had the challange to create a top 10 biggest resutls chart using a domain driven dataset.  After a fair bit of searching I've managed to scrape together enough knowledge to do this but thought I'd put my findings here in one place so others can re-create this.

Step 1 - Create full dataset chart in jasper reports adhoc editor.

Step 2 - import chart into ireports frmo jasperserver repository

Step 3 - modify chart to show max 10 records.  Right click report, choose chart data.  under the dataset tab choose the filter expression memo field and add the following code: new Boolean($V{REPORT_COUNT}.intValue()<=10)

Step 4 - add a sort field to the report to sort by your charts measure. The sum of your measure will actually be stored as a field so this can be used to sort the chart reliably.  Do this by clicking the icon to enter details on the report query and choosting sort options from the bottom of the popup.  Then add field and choose the field that is used by your reports measure and set ti as Descending.

This should be all that is necessary to create a top 10 results chart.  I've attached the JRXML and an example output to assist in anyone who wants to follow this.

Post Edited by yananderson at 08/02/2012 11:34
yananderson's picture
Joined: Aug 2 2012 - 1:33am
Last seen: 9 years 4 months ago


I want to thank you. It is very clear and it works fine.

Kind regards,


patrick.dewitt - 9 years 7 months ago


I am trying the same method to create a pie chart using html5 chart in iReport.

However i am getting the top10 records from the domain dataset  But i need top10 records by countwise in a column.

Please help me on that... 


raja.shekar - 8 years 4 months ago

0 Answers:

No answers yet