Sign in to follow this  

Pie chart question

Recommended Posts

For my pie chart, I currently have two slices, one representing the total dollar amount of apples and the other slice representing the totla dollar amount of oranges. Is there a way to display a second (or even third) label/amount, for the same slice ? For example, the original pie slice displays $50.00 for apples and $50.00 for organges. Since the total amount is $100.00. I want to display a second label/amount for apples, displaying '50% of total', and also displaying '50% of total' for organes. So for each slice, I want to display the dollar amount and the percentage of that amount, compared to the total.


Share this post

Link to post
Share on other sites
Guest Rajroop





Since you would like to have another label/amount display for each slice of the pie, whether it be oranges or apples, you could consider using a new line break for this.




Here's the idea.


We require two labels for each slice. We introduce a new line break, in-between the labels, and add the second item to the initial label.




The new-line break would be by using .




For example:


<chart caption='Company Revenue' showPercentageValues='1'>


<set label='Services and Consultancy' value='26' />


<set label='Hardware and Software' value='32' />






I hope this helps. :)

Share this post

Link to post
Share on other sites

This is the code that I am using in coldfusion for my pie chart. It basically creates an xml string and uses the renderChart command to call variable strXMLPie to produce the pie chart. It works fine. The variable name 'fruit' is either apples or oranges and the variable totalCharges is the cost of each. I tried to use your method with the line break and but it does not like it. I think # is causing the problem, since that is a coldfusion sysmbol.

Can you help me with my code below and see exactly where your commands fit ?

<cfset strXMLPie = "<chart caption='Apple vs. Oranges' subCaption='January 2010' animation='1' pieSliceDepth='30' showborder='0' baseFontSize='15' formatNumber='1' formatNumberScale='0' numberPrefix='$'>">


<cfloop query="qry">


<cfset strXMLPie = strXMLPie &  "<set label='#fruit#' value='#totalCharges#' link='" & '../reports/xxxReport' & "'/>"> 




<cfset strXMLPie = strXMLPie & "</chart>">

Share this post

Link to post
Share on other sites
Guest Madhumita


You can try following the steps below and see if this helps:

1. Use the displayValue attribute in the <set> element to display your custom label.

2. Break down the custom display value in as many lines you wish using the line-break chracter.

e.g. <set label="Apple" value="50" displayValue="Total Dollar Amount: $50.00 Percentage Value= 50% " />

I hope this helps you.

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