Skip to content

Commit 1565430

Browse files
committed
do not retrieve total if we do not have a number
1 parent d530096 commit 1565430

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/data.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,13 @@ ChartInternal.prototype.getRatio = function(type, d, asPercent = false) {
619619
ratio = d.value / $$.getTotalDataSum();
620620
}
621621
} else if (type === 'index') {
622-
const total = $$.getTotalPerIndex($$.axis.getId(d.id));
623-
if (total && total[d.index] > 0 && isNumber(d.value)) {
624-
ratio = d.value / total[d.index];
622+
if (isNumber(d.value)) {
623+
const total = $$.getTotalPerIndex($$.axis.getId(d.id));
624+
if (total && total[d.index] > 0) {
625+
ratio = d.value / total[d.index];
626+
} else {
627+
ratio = 0;
628+
}
625629
} else {
626630
ratio = 0;
627631
}

0 commit comments

Comments
 (0)