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)
Percentage in Legend
pmathieu
Hello All,
In Crystal Reports, it's common to display the percentage value in the legend next to the Label. Is this possible in BIRT (v 4.2.2)?
Find more posts tagged with
Comments
kclark
From the chart UI under format chart > value series. Select show series labels. Then remove category data then add Percentile Value Data. Uncheck visible for the leader lines. Then you can add the percentage data to the legend like this.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>var percentage = new java.util.ArrayList();
var i = 0;
var j = 0;
function beforeDrawDataPointLabel( dph, label, icsc )
{
percentage.add(label.getCaption().getValue());
label.getCaption().setValue("");
i++;
}
function beforeDrawLegendItem( lerh, bounds, icsc )
{
var legendLabel = lerh.getLabel().getCaption().getValue();
legendLabel = legendLabel + percentage.get(j);
lerh.getLabel().getCaption().setValue(legendLabel);
j++;
}
</pre>
pmathieu
An absolutely perfect solution (although I did add a space between the label and percentage value
). Thank you for your help kclark.
kclark
No problem! Happy it's working for you, let us know if you have anymore questions.