This is an automated email from the ASF dual-hosted git repository. sushuang pushed a commit to branch release in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit 119197611e132ff21d9af2052fc3487894760672 Author: SHUANG SU <sushuang0...@gmail.com> AuthorDate: Thu Nov 7 05:18:44 2019 +0800 fix: make code more robust. --- src/layout/barGrid.js | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/layout/barGrid.js b/src/layout/barGrid.js index 069cc25..09e85e3 100644 --- a/src/layout/barGrid.js +++ b/src/layout/barGrid.js @@ -130,24 +130,26 @@ function getValueAxesMinGaps(barSeries) { }); var axisMinGaps = []; - for (var i in axisValues) { - var valuesInAxis = axisValues[i]; - if (valuesInAxis) { - // Sort axis values into ascending order to calculate gaps - valuesInAxis.sort(function (a, b) { - return a - b; - }); - - var min = null; - for (var j = 1; j < valuesInAxis.length; ++j) { - var delta = valuesInAxis[j] - valuesInAxis[j - 1]; - if (delta > 0) { - // Ignore 0 delta because they are of the same axis value - min = min === null ? delta : Math.min(min, delta); + for (var key in axisValues) { + if (axisValues.hasOwnProperty(key)) { + var valuesInAxis = axisValues[key]; + if (valuesInAxis) { + // Sort axis values into ascending order to calculate gaps + valuesInAxis.sort(function (a, b) { + return a - b; + }); + + var min = null; + for (var j = 1; j < valuesInAxis.length; ++j) { + var delta = valuesInAxis[j] - valuesInAxis[j - 1]; + if (delta > 0) { + // Ignore 0 delta because they are of the same axis value + min = min === null ? delta : Math.min(min, delta); + } } + // Set to null if only have one data + axisMinGaps[key] = min; } - // Set to null if only have one data - axisMinGaps[i] = min; } } return axisMinGaps; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org