Reputation: 17
I am using react-native-chart-kit pie chart.
In the data array, instead of writing a number in the population, I am writing “this.state.data” as shown below since I am getting the numbers from an API.
const pieData1 = [
{
name: ': East',
population: this.state.data,
color: '#00664f',
legendFontColor: 'black',
legendFontSize: 12,
},
]
But I get the error "error while updating property "d" of a view managed by RNSVGPath:". Any idea how to solve it please?
Upvotes: 0
Views: 2162
Reputation: 27
I confirm this is the fix for the issue. I experienced same error on PieChart until I realized that property I pass to as a float turned out to be a string. JavaScript is not strong typed language - hence adding parseFloat resolved the issue.
Upvotes: 0
Reputation: 21
Actually the thing is by default chart requires data other than empty.
just maintain some kind assign value in state.
Upvotes: 2
Reputation: 46
Just typecast your state to Integer using parseInt
const pieData1 = [
{
name: ': East',
population: parseInt(this.state.data), ////
color: '#00664f',
legendFontColor: 'black',
legendFontSize: 12,
},
Upvotes: 0