Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to add percentage value and total value to pie chart legend
Nhan
Dear all,
My request is that the legend will show the percentage which calculate from the number of each item with the total.How can I do it to show the percentage and also the total in the legend? Please see my graph
Thanks
Find more posts tagged with
Comments
lrnrit
<blockquote class='ipsBlockquote' data-author="'Nhan'" data-cid="90454" data-time="1323245817" data-date="07 December 2011 - 01:16 AM"><p>
Dear all,<br />
My request is that the legend will show the percentage which calculate from the number of each item with the total.How can I do it to show the percentage and also the total in the legend? Please see my graph<br />
Thanks<br /></p></blockquote>
Hi,<br />
<br />
Calculate Percentage and append its value to the legend. you can write script for it on render function of chart.<br />
<br />
Refer given report script. Legends are appended with "XX".<br />
<br />
Hope it will help you.<br />
<br />
lrnit
Nhan
Is there something wrong with your report?The chart get problem to open. It show invalid chart message
Nhan
What's wrong? What do you mean?
Nhan
I receive meaningless feedback. I don't understand anything. Can anyone support me?
lrnrit
<blockquote class='ipsBlockquote' data-author="'Nhan'" data-cid="90780" data-time="1323308271" data-date="07 December 2011 - 06:37 PM"><p>
Is there something wrong with your report?The chart get problem to open. It show invalid chart message<br /></p></blockquote>
<br />
<br />
Hi,<br />
<br />
I dont now its working fine on my side. What version of birt you are using? Let me know? <br />
<br />
lrnit
Nhan
I use version 3.2.21.
lrnrit
<blockquote class='ipsBlockquote' data-author="'Nhan'" data-cid="90926" data-time="1323331647" data-date="08 December 2011 - 01:07 AM"><p>
I use version 3.2.21.<br /></p></blockquote>
<br />
<br />
Hi,<br />
<br />
Try this file and in place of "xx" put calculated %.<br />
<br />
lrnit
Nhan
Thank you very much for your feedback. This is the code to drawLegend
function beforeDrawLegendItem( lerh, bounds, icsc )
{
//lerh.getLabel().getCaption().setValue("xx");
var x = lerh.getLabel().getCaption().getValue();
lerh.getLabel().getCaption().setValue(x + "xx");
//icsc.getChartInstance().getLegend().setText("****");
}
How can I calculate % value for the item on the graph when it runs this method? How can I add Total 100% Lengend Item in the legend?
Thanks and regards