react-native-gifted-charts
react-native-gifted-charts copied to clipboard
PieChart & PieChartPro prop mismatch
<PieChart> and <PieChartPro> component are said to have same props
Animation and curved paths are supported in <PieChartPro> component. It receives all the above props (same as the <PieChart> component)
yet in fact they do not. See below:
Case Pie Chart default component
<PieChart
donut
initialAngle={-Math.PI * 2}
centerLabelComponent={innerLabel}
innerRadius={80}
innerCircleColor={Colors.BACKGROUND_PRIMARY}
radius={wp(25)}
data={pieData}
/>
Case Pie Chart PRO component
// same props, different component
<PieChartPro
donut
initialAngle={-Math.PI * 2}
centerLabelComponent={innerLabel}
innerRadius={80}
innerCircleColor={Colors.BACKGROUND_PRIMARY}
radius={wp(25)}
data={pieData}
/>
Note the differences:
- Initial angle does not work on Pro component
- Pie data is reversed in Pro (Pie values grow counter clock-wise)
I have solved these issues in use with the below solutions:
- Not using the Pro component - it has issues with animated input values for in pieData => Smoother to rerender pie
- Using Array.reverse()