This is a migrated thread and some comments may be shown as answers.

Sum of precentages exceed 100% in pie chart

1 Answer 121 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Jerome
Top achievements
Rank 1
Jerome asked on 26 Jul 2008, 03:26 AM
Following are the example values for the pie chart
A. 1568(30%)
B. 3015(57%)
C. 720(14%)
From the case above, the sum of the precentage is 101%. I understand it is a rounding problem but what I have in Excel is 56% for B instead of 57%. I would like to check is there build in method to ensure the sum of precentages in the pie chart is 100% in RadChart?

1 Answer, 1 is accepted

Sort by
0
Accepted
Dwight
Telerik team
answered on 28 Jul 2008, 08:47 AM
Hi Jerome,

Thank you for noting that issue. Currently our RadChart does not support ways to control the values in the output.

Now, let me provide you with the analysis I've done on the sample data:
A. 1568 -> 29.56816896%
B. 3015 -> 56.8546106%
C. 720 -> 13.57722044%

It is mathematically correct to round up to respectively 30, 57 and 14, which makes a sum ot 101.
When evaluating the rounding error, you will see, that the difference (errors) towards the original values are:
A. |30 - 29.56816896| = 0.431831039 (the error for A)
B. |57 - 56.8546106| = 0.145389402 (the error for B)
C. |14 - 13.57722044| = 0.422779559 (the error for C)
which sum up to 1.0
. That is the total error you get, and you get it in the output.

Now, in the case of the values provided by Excel:
A. |30 - 29.56816896| = 0.431831039
B. |56 - 56.85461060| = 0.854610598
C. |14 - 13.57722044| = 0.422779559
In this case the errors sum up to 1.709221196, which is way greater than the error of 1.0
This error is not obvious in the chart since the values sum up to 100, but it is there.

The mathematical rounding is defined in such a way, that it actually minimizes the calculation errors, meaning that there is no way to get smaller error, which in our case is 1.0

Further analysis show that to satisfy both constraints (minimizing the error and having the sum equal to 100) , we need to round value A to 29:
A. |29 - 29.56816896| = 0.568168961
B. |57 - 56.85461060| = 0.145389402
C. |14 - 13.57722044| = 0.422779559
Here the errors sum up to 1.136337922, which is a smaller than 1.7092...

That said, the solution I deem more precise is 29, 57, 14.

To give a general solution in our RadChart, we need to further analyze the problem, as in cases of random data it might prove to be more complicated problem.

Regards,
Evtim
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Chart (Obsolete)
Asked by
Jerome
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Share this question
or