From 156543045542758081b6020b4c496e2de265dbfb Mon Sep 17 00:00:00 2001 From: Anthony Pessy Date: Wed, 11 Sep 2019 15:48:50 +0200 Subject: [PATCH] do not retrieve total if we do not have a number --- src/data.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/data.js b/src/data.js index 86c5fe278..049beade9 100644 --- a/src/data.js +++ b/src/data.js @@ -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; }