Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Math.ceil instead of Math.round in pie.js results in wrong Percentages > 100% total #27

Open
ChrisKam opened this issue Aug 29, 2014 · 2 comments

Comments

@ChrisKam
Copy link

Hi there, thank you for this great component!

You can reproduce this issue for example with the following numbers: Make a Pie Chart with 55, 21, 9, 15 which will result in 56%, 21%, 9%, 15% on the rendered chart.

Line 76 in pie.js is responsible, instead of

var visible_text = Math.ceil(percent) + '%';

it should be

var visible_text = Math.round(percent) + '%';

I would put in a pull request but unfortunately I don't have Git on this machine. I just thought I let you know in case somebody else runs into this issue.

Best
Chris

@kevinralph
Copy link

Chris, thank you for posting this. I used these pie charts on a project almost a year ago and they contacted me today saying they changed the data and it was adding up to 101%. Your post saved me a lot of time.

@ChrisKam
Copy link
Author

Hey, thank you for the message - glad I could help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants