Skip navigation
chiechie
Currently Being Moderated

How to show decimal in PieChart Percentages?

Jul 17, 2007 11:41 AM

Hi. I have 3 companies to show in a pie chart:

CompA: $350
CompB: $450
CompC: $371

Total: $1171

CompA has 29.9%
CompB has 38.4%
CompC has 31.7%

I want to show a pie chart with percentages such as 29.9% instead of 30%, or 31.7% instead of 32%.

Is there a way to achieve this detail using CF7 cfchart ???

I have spent quite a bit of time but could not find a solution... Please help!!!

 
Replies
  • Currently Being Moderated
    Jul 16, 2012 3:02 PM   in reply to chiechie

    I'd like to know this too!

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 21, 2012 1:09 AM   in reply to chiechie

    Multiply by 1000 and round up, to pick out the 3 significant digits. Then divide by 10 to get the percentage.

     

    <cfset a=round(1000*350/1171)/10>

    <cfset b=round(1000*450/1171)/10>

    <cfset c=round(1000*371/1171)/10>

     

    <cfchart> 

    <cfchartseries type="Pie" >

    <cfchartdata item="CompA" value="#a#">

    <cfchartdata item="CompB" value="#b#">

    <cfchartdata item="CompC" value="#c#">

    </cfchartseries>

    </cfchart>

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)