iReport Pie Chart Report

This blog i will show how to make a pie chart report. here i used very simple report. I have one table called category it has different categoryno with categroy name. Each category has subcategory. I want to show how many categories are there by pie chart.  Category table struc and data link will give you the table structure and some sample data. I used MySql database for this report.

  • Create New document from iReport. use this band value title = 30, columnHeader = 15, detail = 15 and summary = 300 and others = 0.
  • Add Query:     select category “Cat No”, subcat_name “category Name”, count(category) total from category
    group by category order by 1
  • Add 3 fields – Cat No, Category Name, Total to Detail band.    detail-band
  • Click the char button and select the Pie 3D. I put its width is 268 and height is 203.   ui2
  • right click on chart and select cart properties. select cart data tab, select the Details tab. and put the value as follows -  for Key Expression = $F{category Name} ,  Value Expression = $F{total},  Label Expression = $F{category Name}
  • click close.
  • b4 execute you must select your database connection. now click Execute with data connection. the output file will looks like as follows

output-pie-report

Advertisement

4 Responses to iReport Pie Chart Report

  1. Jayaprada says:

    very usefull post on creating pie chart using jasper report.

    Thanks,
    Jaya

  2. Azizi Yazit says:

    Hi.

    Your post is quiet usefull for newbie..However, there is no java code for display chart in pdf file.

    Do you know how? and could you send to me guide/tutorial if you know?

  3. Sedef says:

    hi,

    Im sorry to bother you, if you mind, I had a question for you about that topic. First of all, I m using the netbeans IDE 6.7 with ireport 3.5.2 plug in and the oracle to take datas. Here is my problem I couldn’t understand the (right click on chart and select cart properties. select cart data tab, select the Details tab. and put the value as follows – for Key Expression = $F{category Name} , Value Expression = $F{total}, Label Expression = $F{category Name}) part when I clicked on the right button there is chart data and in it there are two choices details and datasets how could I fill in the blanks, there is nothing into details, I mean the concept of the graph first I had to write sum of the numbers and seperate them into the groups can someone explain me that, if you mind to help me, I would really appreciate it.

  4. Sedef says:

    I did it wuhuu :D ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.