Merge pull request #292 from jardelbordignon/fix/piechart-uninitialized-total-var

Fix uninitialized total variable when using in web
This commit is contained in:
Abhinandan Kushwaha 2023-07-01 17:28:33 +05:30 committed by GitHub
commit fae064e29d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -142,7 +142,9 @@ export const PieChartMain = (props: propTypes) => {
let minShiftX = 0,
maxShiftX = 0,
minShiftY = 0,
maxShiftY = 0;
maxShiftY = 0,
total = 0;
data.forEach((item: any) => {
total += item.value;
if (item.shiftX || item.shiftY) {
@ -172,7 +174,7 @@ export const PieChartMain = (props: propTypes) => {
let cx = radius,
cy = radius;
let total =
total =
data && data.length
? data.map(item => item.value).reduce((v, a) => v + a)
: 0;