You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2019/11/06 21:19:34 UTC
[incubator-echarts] 03/03: fix: make code more robust.
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch fix/release-chore
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit 5b37e6260c91b6aa74ea804112e6517a90248cfb
Author: SHUANG SU <su...@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-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org