Sign in to follow this  
rtibmx

Format labels on pie chart?

Recommended Posts

Next to each slice on my pie chart I want to have the labels in the format of "xxxxxx (y%)". For instance labels like:

 

Florida (15%)

 

New York (7%)

 

California (2%)

 

 

 

Currently I've gotten close by using showPercentValues='1' . This has made it at least so it is showing the % in the labels instead of the raw numbers.

 

 

 

However it is currently showing this in the format of: "xxxxx, y%".

 

 

 

For example, currently I get:

 

 

 

Florida, 15%

 

New York, 7%

 

California, 2%

 

 

 

How can I change this to the format I showed at the top of the message. I know that I can use the option to override the entire label with something I want, but that would cause me to have to calculate the % myself and I'd rather not.

 

 

 

Thanks!

Share this post


Link to post
Share on other sites

Hi,

 
Could you please try using the following XML?
 
<chart showPercentValues='0'  labelSepChar=' ' numberprefix='(' numberSuffix='%)'  >

 <set label='France' value='17'  />

 <set label='India' value='12' />

 <set label='Brazil' value='18' />

 <set label='USA' value='8' />

 <set label='Australia' value='10' />

 <set label='Japan' value='16' />

 <set label='England' value='11' />

 <set label='Nigeria' value='12' />

 <set label='Italy' value='8' />

 <set label='China' value='10' />

 <set label='Canada' value='19'/>

 <set label='Germany' value='15'/>

</chart>

Edited by Guest

Share this post


Link to post
Share on other sites

With that approach you showed it will indeed use the "label (xxx%)" format as desired.

 

 

 

However, it only will work if showPercentValues is set to 0 as you suggested. Otherwise the "(" and "%)" chars do not apply.

 

 

 

So the problem is, when I set showPercentValues to 0, then the number shown for the percentage is actually the total for that slice, and not its percentage! :)

 

 

 

For example, let's say that I have a value of 520 which represents 15% of the total. When I change my code to use your snippet it shows up in the label as "Item (520%)" instead of "Item (15%)". This obviously is because showPercentValues is set to 0, but alas if you switch it to showPercentvalues of 1 then the "(" and "%)" chars to not show up... Please advise. Thanks.

Share this post


Link to post
Share on other sites
Rahul Kumar (3/5/2009)
Hi,
I am sorry, I did not notice that. And I am afriad, it is not possible as of now.

 

 

 

Thanks for letting me know. A competitor's Flash chart product that we are evaluating has a very nice, extensive list of formatting options done with special format strings. I hope you will consider adding such a feature.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this