Skip to content

Commit

Permalink
do not retrieve total if we do not have a number
Browse files Browse the repository at this point in the history
  • Loading branch information
panthony committed Sep 11, 2019
1 parent d530096 commit 1565430
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,13 @@ ChartInternal.prototype.getRatio = function(type, d, asPercent = false) {
ratio = d.value / $$.getTotalDataSum();
}
} else if (type === 'index') {
const total = $$.getTotalPerIndex($$.axis.getId(d.id));
if (total && total[d.index] > 0 && isNumber(d.value)) {
ratio = d.value / total[d.index];
if (isNumber(d.value)) {
const total = $$.getTotalPerIndex($$.axis.getId(d.id));
if (total && total[d.index] > 0) {
ratio = d.value / total[d.index];
} else {
ratio = 0;
}
} else {
ratio = 0;
}
Expand Down

0 comments on commit 1565430

Please sign in to comment.