mirror of
https://github.com/status-im/react-native-gifted-charts.git
synced 2025-02-23 00:58:11 +00:00
Fixed bug- Reduce of empty array with no initial value in piechart
This commit is contained in:
parent
27ebfd3adf
commit
331c76b69e
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-native-gifted-charts",
|
"name": "react-native-gifted-charts",
|
||||||
"version": "1.2.11",
|
"version": "1.2.12",
|
||||||
"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.",
|
"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.",
|
||||||
"main": "src/index.tsx",
|
"main": "src/index.tsx",
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -164,7 +164,10 @@ export const PieChart = (props: propTypes) => {
|
|||||||
let cx = radius,
|
let cx = radius,
|
||||||
cy = radius;
|
cy = radius;
|
||||||
|
|
||||||
let total = data.map(item => item.value).reduce((v, a) => v + a);
|
let total =
|
||||||
|
data && data.length
|
||||||
|
? data.map(item => item.value).reduce((v, a) => v + a)
|
||||||
|
: 0;
|
||||||
let acc = 0;
|
let acc = 0;
|
||||||
let pData = data.map(item => {
|
let pData = data.map(item => {
|
||||||
acc += item.value / total;
|
acc += item.value / total;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user