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 change pie slice percentage decimal places
mmarc442
Generating a pie chart. Slices have displayed percentages of 35.71%, 1.79%, 14.29% etc.
How do I change it to display 36%, 2%, 14%, etc. ?
Find more posts tagged with
Comments
kclark
You could use Math.round() in the beforeDrawDataPointLabel() like this<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>function beforeDrawDataPointLabel( dph, label, icsc )
{
var oldValue = new String(label.getCaption().getValue());
var newValue = parseFloat(oldValue);
newValue = Math.round(newValue);
var newCaption = newValue + "%";
label.getCaption().setValue(newCaption);
}
</pre>
mmarc442
Works great ! Thanks !