react-native-pie-chart icon indicating copy to clipboard operation
react-native-pie-chart copied to clipboard

A number sequence produces the wrong chart proportions

Open egeola opened this issue 7 years ago • 4 comments

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']

egeola avatar Jul 17 '18 23:07 egeola

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.

misheki avatar Sep 04 '18 03:09 misheki

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.

aidin36 avatar Aug 20 '21 03:08 aidin36

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

tangimds avatar Mar 31 '22 11:03 tangimds

Thanks for testing! I'll have a look.

aidin36 avatar Mar 31 '22 19:03 aidin36

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

aidin36 avatar Dec 09 '22 00:12 aidin36