Pie Chart Percentage Problem

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
LorraineS
Posts: 4
Joined: Fri Sep 15, 2006 2:28 pm

Pie Chart Percentage Problem

Post by LorraineS » Fri Sep 07, 2007 3:15 pm

I have a pie chart and I display the percent for the pie labels. However, if you add up all the percent values, the total is 101% (> 100%).

Is this a known problem? Is there any solution for this?

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Re: Pie Chart Percentage Problem

Post by RichardWest » Fri Sep 07, 2007 5:15 pm

LorraineS wrote:if you add up all the percent values, the total is 101% (> 100%).

Is this a known problem? Is there any solution for this?
This sounds like a rounding issue. Increase the decimal precision and take the sum again. If the issue still remains after adding several more decimal places, there may be a more serious issue.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

LorraineS
Posts: 4
Joined: Fri Sep 15, 2006 2:28 pm

Post by LorraineS » Fri Sep 07, 2007 5:29 pm

I increased the decimal precision as suggested. Now the sum is 100.01%. I need to guarantee 100% when adding them up. Any way to do this?

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Post by RichardWest » Fri Sep 07, 2007 6:19 pm

LorraineS wrote:I increased the decimal precision as suggested. Now the sum is 100.01%. I need to guarantee 100% when adding them up. Any way to do this?
None that I can think of offhand.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

Locked