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

Duplicate Y-Axis Labels

Open bwjohns4 opened this issue 3 years ago • 6 comments

Has anyone encountered this issue where there are duplicate Y axis labels?

image

bwjohns4 avatar Jun 14 '22 21:06 bwjohns4

Yes, me. Basically this are not duplicated, if you set decimals to 1 or 2 you will see in fact are different values. But if y values are in fact 1,7 and 2.4 both values are rounded at 2.

moisfelix avatar Jul 05 '22 11:07 moisfelix

Interesting. My application only uses whole numbers. Is there a way to set this up so that it does not show y-axis increments of less than a whole number increment?

I'm already using: yAxisInterval={1}

bwjohns4 avatar Jul 06 '22 01:07 bwjohns4

@bwjohns4 I also faced issue. the problem was as there are 5 lines of Y axis,all given data value will fill these lines my initial value is set to zero : fromZero={true} , if max value is less than 4 , the other values will be duplicated to fill 5 lines, so the solution is you need also give max value like this: fromNumber={Math.max(...arrdata) > 4 ? Math.max(...arrdata) : 4 }
Screen Shot 2022-07-24 at 20 44 05 if data value is higher than 4 then it draw like this: Screen Shot 2022-07-24 at 20 44 59 Screen Shot 2022-07-24 at 20 48 55

BuniEmris avatar Jul 24 '22 15:07 BuniEmris

@BuniEmris Thank you for above solution. I had similar issue and suggesstions worked like a charm.

Girishav avatar Jul 25 '22 14:07 Girishav

@bwjohns4 I also faced issue. the problem was as there are 5 lines of Y axis,all given data value will fill these lines my initial value is set to zero : fromZero={true} , if max value is less than 4 , the other values will be duplicated to fill 5 lines, so the solution is you need also give max value like this: fromNumber={Math.max(...arrdata) > 4 ? Math.max(...arrdata) : 4 } Screen Shot 2022-07-24 at 20 44 05 if data value is higher than 4 then it draw like this: Screen Shot 2022-07-24 at 20 44 59 Screen Shot 2022-07-24 at 20 48 55

Thanks @BuniEmris It works for me

ZainAliSyed24 avatar Dec 01 '23 15:12 ZainAliSyed24

I am having the same issue for a LineChart. If I allow it to show more decimal places, it shows {1,1.5,2,2.5,3}. Is there a similar solution for a LineChart? LineCharts unfortuantely don' thave "showBarTops" property.

IMG_366C560338BA-1

TrevorGarnett avatar Apr 17 '24 21:04 TrevorGarnett