Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to create Pie chart with percentage of multiple columns
cpatel
Hi,
I am using BIRT 3.7.1.
I need to create pie chart with percentage. For example,
Craft | Inspection | Repair | Maintenance | Total_Hrs
MECH | 40 |80 | 20 |140
So, pie chart should display,
Category:
Inspection -> 28.57%
Repair -> 57.14%
Maintenance -> 14.29%
Is it possible with BIRT pie chart? If anyone has example report, it would help a lot.
I appreciate any help!!
Find more posts tagged with
Comments
Hans_vd
Hi cpatel,
This article describes exactly what you need:
http://enterprisesmartapps.wordpress.com/2013/02/18/columns-to-rows-in-birt-data-set/
And this followup article describes a - in my opinion - slightly more elegant approach:
http://enterprisesmartapps.wordpress.com/2013/02/22/birt-columns-to-rows-in-data-set-part-2/
Hope it helps
Hans
cpatel
Thanks a lot Hans! It works perfectly !!!<br />
<br />
- Chirag<br />
<br />
<blockquote class='ipsBlockquote' data-author="'Hans_vd'" data-cid="115509" data-time="1364544509" data-date="29 March 2013 - 01:08 AM"><p>
Hi cpatel,<br />
<br />
This article describes exactly what you need: <a class='bbc_url' href='
http://enterprisesmartapps.wordpress.com/2013/02/18/columns-to-rows-in-birt-data-set/'>http://enterprisesmartapps.wordpress.com/2013/02/18/columns-to-rows-in-birt-data-set/</a><br
/>
<br />
And this followup article describes a - in my opinion - slightly more elegant approach: <a class='bbc_url' href='
http://enterprisesmartapps.wordpress.com/2013/02/22/birt-columns-to-rows-in-data-set-part-2/'>http://enterprisesmartapps.wordpress.com/2013/02/22/birt-columns-to-rows-in-data-set-part-2/</a><br
/>
<br />
Hope it helps<br />
Hans<br /></p></blockquote>
Hans_vd
Hi cpatel,
Great to see it worked out for you.
Just out of curiosity, what approach did you follow? First or second link?
Regards
Hans
cpatel
Hans,<br />
<br />
I followed second approach as it looked less complicated than first one. I haven't tried the first approach yet.<br />
<br />
But when I understood the logic, I found that we are converting table columns into table rows through the coding. So, I am wondering if we use "Union All" in SQL query to convert table columns into table rows, we can eliminate all these coding.<br />
<br />
For example,<br />
<br />
Select department, infrastructure, training, communications, consumables from budgetforecast;<br />
<br />
If we want to have pie chart based on columns "infrastructure, training, communications and consumables", then I would write SQL statement like,<br />
<br />
Select department, 'Infrstructure' as budgetType, infrastructure as budget from budgetforecast<br />
Union All<br />
Select department, 'Training' as budgetType, training as budget from budgetforecast<br />
Union All<br />
Select department, 'Communications' as budgetType, communications as budget from budgetforecast<br />
Union All<br />
Select department, 'Consumables' as budgetType, consumables as budget from budgetforecast<br />
;<br />
<br />
And we can use resultset directly into pie chart. <br />
<br />
-Chirag Patel<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'Hans_vd'" data-cid="115545" data-time="1364635014" data-date="30 March 2013 - 02:16 AM"><p>
Hi cpatel,<br />
<br />
Great to see it worked out for you.<br />
Just out of curiosity, what approach did you follow? First or second link?<br />
<br />
Regards<br />
Hans<br /></p></blockquote>
Hans_vd
Hi cpatel,
You are right.
As a matter of fact, the blogpost mentions a different approach for data sources that can handle SQL and data sources that can't. Take another look at
http://enterprisesmartapps.wordpress.com/2013/02/18/columns-to-rows-in-birt-data-set/
and scroll down to the bottom... :-)
Regards
Hans