genexu / react-native-pie-chart

Simple pie chart module for your React Native app
MIT License
109 stars 47 forks source link

A number sequence produces the wrong chart proportions #20

Closed egeola closed 1 year ago

egeola commented 6 years ago

This gives me a completely green donut.
const chart_wh = 300 const series = [7, 2, 13, 0] const sliceColor = ['#F44336','#2196F3','#FFEB3B', '#4CAF50']

Adding an extra 0 to series gives me the right proportions though const chart_wh = 300 const series = [7, 2, 13, 0, 0] const sliceColor = ['#F44336','#2196F3','#FFEB3B', '#4CAF50']

misheki commented 5 years ago

I am having the same issue with these numbers: const series = [3, 8, 2, 3, 0, 0]; const sliceColor = [colors.lightYellow, colors.lightBlue, colors.lightPink, colors.lightGreen, colors.lightPurple, colors.light_grey];

This gives me a completely gray donut too. If I change the order of the numbers 3,8,2,3 will still give a gray donut except when one of them occupies the last position. If I change any of the numbers, it will give me the correct proportions.

aidin36 commented 2 years ago

I'm closing this because it's quite old and I couldn't re-produce it. Fee free to open this, or open a new issue if it's still a problem.

tangimds commented 2 years ago

Hello, FYI I'm having the same issue.

Here are the series that cause the problem :

[13, 1, 0, 1, 1, 0]
[14, 0, 1, 0, 1, 0]

I manage to reproduce the bug with @misheki series [3, 8, 2, 3, 0, 0]

the sliceColor array is the same length of my series. if i change one number of the series above, it works as expected

In my case, the only thing I notice is the fact that the sum is 16 and the last number is 0... it doesn't really help :(

I might use this one instead

aidin36 commented 2 years ago

Thanks for testing! I'll have a look.

aidin36 commented 1 year ago

Seems that it was the same issue reported in https://github.com/genexu/react-native-pie-chart/issues/33 Fixed now in 2.1.0