react-native-gifted-charts 1.2.11 → 1.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gifted-charts",
3
- "version": "1.2.11",
3
+ "version": "1.2.12",
4
4
  "description": "The most complete library for Bar, Line, Area, Pie, Donut and Stacked Bar charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
5
5
  "main": "src/index.tsx",
6
6
  "files": [
@@ -164,7 +164,10 @@ export const PieChart = (props: propTypes) => {
164
164
  let cx = radius,
165
165
  cy = radius;
166
166
 
167
- let total = data.map(item => item.value).reduce((v, a) => v + a);
167
+ let total =
168
+ data && data.length
169
+ ? data.map(item => item.value).reduce((v, a) => v + a)
170
+ : 0;
168
171
  let acc = 0;
169
172
  let pData = data.map(item => {
170
173
  acc += item.value / total;