Hi,
I am actually trying to display a pie chart in my react-native project, you can see my code below (exactly the same as the example)
<View style={{ padding: 20, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', }}> <PieChart data={[ { name: 'Toronto', population: 2800000 }, { name: 'Dublin', population: 527612 }, { name: 'New York', population: 8538000 }, { name: 'Beijing', population: 21500000 }, { name: 'Moscow', population: 11920000 } ]} width={Dimensions.get('window').width} height={220} chartConfig={{ backgroundGradientFrom: '#ccff33', backgroundGradientTo: '#ffff33', color: () => #000 }} accessor="population" /> </View>
But i'm getting this error:
`TypeError: TypeError: TypeError: undefined is not a function (evaluating 'data.entries()typeof Symbol === "function" ? Symbol.iterator : "@@iterator"')
This error is located at:
in PieChart (at Home.js:17)
in RCTView (at View.js:60)
in View (at Home.js:15)
in RCTView (at View.js:60)
in View (at Home.js:14)
in Home (at SceneView.js:9)
in SceneView (at createTabNavigator.js:10)
in RCTView (at View.js:60)
in View (at createAnimatedComponent.js:154)
in AnimatedComponent (at BottomNavigation.js:558)
in RCTView (at View.js:60)
in View (at createAnimatedComponent.js:154)
in AnimatedComponent (at BottomNavigation.js:543)
in RCTView (at View.js:60)
in View (at BottomNavigation.js:527)
in RCTView (at View.js:60)
in View (at BottomNavigation.js:522)
in BottomNavigation (at withTheme.js:75)
in ThemeProvider (at withTheme.js:89)
in withTheme(BottomNavigation) (at createMaterialBottomTabNavigator.js:25)
in BottomNavigationView (at createTabNavigator.js:115)
in NavigationView (at createNavigator.js:57)
in Navigator (at createNavigationContainer.js:383)
in NavigationContainer (at SceneView.js:9)
in SceneView (at SwitchView.js:12)
in SwitchView (at createNavigator.js:57)
in Navigator (at createNavigationContainer.js:383)
in NavigationContainer (at App.js:34)
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)
This error is located at:
in NavigationContainer (at SceneView.js:9)
in SceneView (at SwitchView.js:12)
in SwitchView (at createNavigator.js:57)
in Navigator (at createNavigationContainer.js:383)
in NavigationContainer (at App.js:34)
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)
This error is located at:
in NavigationContainer (at App.js:34)
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)
- node_modules\paths-js\pie.js:39:25 in
- node_modules\react-native-chart-kit\src\pie-chart.js:18:22 in render
- ... 18 more stack frames from framework internals
`
I thought that was a problem with a function called data.entries() in the pie_chart.js code but it doesn't exist in it.
May I have some help please ? :)
Hi,
I am actually trying to display a pie chart in my react-native project, you can see my code below (exactly the same as the example)
<View style={{ padding: 20, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', }}> <PieChart data={[ { name: 'Toronto', population: 2800000 }, { name: 'Dublin', population: 527612 }, { name: 'New York', population: 8538000 }, { name: 'Beijing', population: 21500000 }, { name: 'Moscow', population: 11920000 } ]} width={Dimensions.get('window').width} height={220} chartConfig={{ backgroundGradientFrom: '#ccff33', backgroundGradientTo: '#ffff33', color: () =>#000}} accessor="population" /> </View>But i'm getting this error:
`TypeError: TypeError: TypeError: undefined is not a function (evaluating 'data.entries()typeof Symbol === "function" ? Symbol.iterator : "@@iterator"')
This error is located at:
in PieChart (at Home.js:17)
in RCTView (at View.js:60)
in View (at Home.js:15)
in RCTView (at View.js:60)
in View (at Home.js:14)
in Home (at SceneView.js:9)
in SceneView (at createTabNavigator.js:10)
in RCTView (at View.js:60)
in View (at createAnimatedComponent.js:154)
in AnimatedComponent (at BottomNavigation.js:558)
in RCTView (at View.js:60)
in View (at createAnimatedComponent.js:154)
in AnimatedComponent (at BottomNavigation.js:543)
in RCTView (at View.js:60)
in View (at BottomNavigation.js:527)
in RCTView (at View.js:60)
in View (at BottomNavigation.js:522)
in BottomNavigation (at withTheme.js:75)
in ThemeProvider (at withTheme.js:89)
in withTheme(BottomNavigation) (at createMaterialBottomTabNavigator.js:25)
in BottomNavigationView (at createTabNavigator.js:115)
in NavigationView (at createNavigator.js:57)
in Navigator (at createNavigationContainer.js:383)
in NavigationContainer (at SceneView.js:9)
in SceneView (at SwitchView.js:12)
in SwitchView (at createNavigator.js:57)
in Navigator (at createNavigationContainer.js:383)
in NavigationContainer (at App.js:34)
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)
This error is located at:
in NavigationContainer (at SceneView.js:9)
in SceneView (at SwitchView.js:12)
in SwitchView (at createNavigator.js:57)
in Navigator (at createNavigationContainer.js:383)
in NavigationContainer (at App.js:34)
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)
This error is located at:
in NavigationContainer (at App.js:34)
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)
`
I thought that was a problem with a function called
data.entries()in the pie_chart.js code but it doesn't exist in it.May I have some help please ? :)