From ec8bb164dd914ab2bd1ef20d672aa11ce3764cef Mon Sep 17 00:00:00 2001 From: zhuangzhuang Date: Fri, 16 Jun 2017 17:04:26 +0800 Subject: [PATCH] fix some doc bugs. fix some js bugs. --- src/chart/bar/PictorialBarView.js | 2 +- src/chart/chord/chordCircularLayout.js | 4 ++-- src/chart/custom.js | 2 +- src/chart/helper/EffectSymbol.js | 2 +- src/chart/sankey/sankeyLayout.js | 2 +- src/chart/themeRiver/themeRiverLayout.js | 2 +- src/component/axisPointer/BaseAxisPointer.js | 3 ++- src/component/helper/BrushTargetManager.js | 2 +- src/component/toolbox/feature/DataView.js | 4 ++-- src/component/tooltip/TooltipView.js | 2 +- src/coord/calendar/Calendar.js | 2 +- src/coord/cartesian/Grid.js | 2 +- src/data/List.js | 2 +- src/data/Tree.js | 2 +- src/echarts.js | 8 ++++---- src/util/format.js | 6 +++--- src/visual/VisualMapping.js | 2 +- test/chord.html | 4 ++-- 18 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/chart/bar/PictorialBarView.js b/src/chart/bar/PictorialBarView.js index e5f3450ff..d8516481d 100644 --- a/src/chart/bar/PictorialBarView.js +++ b/src/chart/bar/PictorialBarView.js @@ -425,7 +425,7 @@ define(function (require) { path.__pictorialRepeatTimes = repeatTimes; bundle.add(path); - var target = makeTarget(index, true); + var target = makeTarget(index); updateAttr( path, diff --git a/src/chart/chord/chordCircularLayout.js b/src/chart/chord/chordCircularLayout.js index 6be732bd5..0eeac54c3 100644 --- a/src/chart/chord/chordCircularLayout.js +++ b/src/chart/chord/chordCircularLayout.js @@ -47,7 +47,7 @@ define(function (require) { if (opts.sort && opts.sort != 'none') { groups.sort(compareGroups); if (opts.sort === 'descending') { - groups.revert(); + groups.reverse(); } } @@ -58,7 +58,7 @@ define(function (require) { if (opts.sortSub && opts.sortSub != 'none') { group.subGroups.sort(compareGroups); if (opts.sortSub === 'descending') { - group.subGroups.revert(); + group.subGroups.reverse(); } } diff --git a/src/chart/custom.js b/src/chart/custom.js index 899a556af..ec7723e1a 100644 --- a/src/chart/custom.js +++ b/src/chart/custom.js @@ -296,7 +296,7 @@ define(function (require) { /** * @public - * @param {nubmer|string} dim + * @param {number|string} dim * @param {number} [dataIndexInside=currDataIndexInside] * @return {number|string} value */ diff --git a/src/chart/helper/EffectSymbol.js b/src/chart/helper/EffectSymbol.js index 80542935d..15fdf3cab 100644 --- a/src/chart/helper/EffectSymbol.js +++ b/src/chart/helper/EffectSymbol.js @@ -112,7 +112,7 @@ define(function (require) { // Must reinitialize effect if following configuration changed var DIFFICULT_PROPS = ['symbolType', 'period', 'rippleScale']; - for (var i = 0; i < DIFFICULT_PROPS; i++) { + for (var i = 0; i < DIFFICULT_PROPS.length; i++) { var propName = DIFFICULT_PROPS[i]; if (oldEffectCfg[propName] !== effectCfg[propName]) { this.stopEffectAnimation(); diff --git a/src/chart/sankey/sankeyLayout.js b/src/chart/sankey/sankeyLayout.js index 8d71dc983..9fa4f2f96 100644 --- a/src/chart/sankey/sankeyLayout.js +++ b/src/chart/sankey/sankeyLayout.js @@ -144,7 +144,7 @@ define(function (require) { * @param {module:echarts/data/Graph~Node} nodes node of sankey view * @param {module:echarts/data/Graph~Edge} edges edge of sankey view * @param {number} height the whole height of the area to draw the view - * @param {numbber} nodeGap the vertical distance between two nodes + * @param {number} nodeGap the vertical distance between two nodes * in the same column. * @param {number} iterations the number of iterations for the algorithm */ diff --git a/src/chart/themeRiver/themeRiverLayout.js b/src/chart/themeRiver/themeRiverLayout.js index 38aef848d..75363f459 100644 --- a/src/chart/themeRiver/themeRiverLayout.js +++ b/src/chart/themeRiver/themeRiverLayout.js @@ -103,7 +103,7 @@ define(function (require) { * Inspired by Lee Byron's paper Stacked Graphs - Geometry & Aesthetics * * @param {Array.} data the points in each layer - * @return {Array} + * @return {Object} */ function computeBaseline(data) { var layerNum = data.length; diff --git a/src/component/axisPointer/BaseAxisPointer.js b/src/component/axisPointer/BaseAxisPointer.js index e9ed5ea65..82100cf8b 100644 --- a/src/component/axisPointer/BaseAxisPointer.js +++ b/src/component/axisPointer/BaseAxisPointer.js @@ -476,7 +476,8 @@ define(function(require) { if (zrUtil.isObject(lastProps) && zrUtil.isObject(newProps)) { var equals = true; zrUtil.each(newProps, function (item, key) { - equals &= propsEqual(lastProps[key], item); + // ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators + equals = equals && propsEqual(lastProps[key], item); }); return !!equals; } diff --git a/src/component/helper/BrushTargetManager.js b/src/component/helper/BrushTargetManager.js index 002a383e0..96ecc02ea 100644 --- a/src/component/helper/BrushTargetManager.js +++ b/src/component/helper/BrushTargetManager.js @@ -200,7 +200,7 @@ define(function(require) { * * @param {Object} area * @param {Array} targetInfoList - * @return {Obejct|boolean} + * @return {Object|boolean} */ proto.findTargetInfo = function (area, ecModel) { var targetInfoList = this._targetInfoList; diff --git a/src/component/toolbox/feature/DataView.js b/src/component/toolbox/feature/DataView.js index d0450739b..c1ce2e503 100644 --- a/src/component/toolbox/feature/DataView.js +++ b/src/component/toolbox/feature/DataView.js @@ -120,7 +120,7 @@ define(function (require) { /** * @param {module:echarts/model/Global} - * @return {string} + * @return {Object} * @inner */ function getContentFromModel(ecModel) { @@ -157,7 +157,7 @@ define(function (require) { var itemSplitRegex = new RegExp('[' + ITEM_SPLITER + ']+', 'g'); /** * @param {string} tsv - * @return {Array.} + * @return {Object} */ function parseTSVContents(tsv) { var tsvLines = tsv.split(/\n+/g); diff --git a/src/component/tooltip/TooltipView.js b/src/component/tooltip/TooltipView.js index b866f866d..6da70dd00 100644 --- a/src/component/tooltip/TooltipView.js +++ b/src/component/tooltip/TooltipView.js @@ -532,7 +532,7 @@ define(function (require) { }, /** - * @param {string|Function|Array.} positionExpr + * @param {string|Function|Array.|Object} positionExpr * @param {number} x Mouse x * @param {number} y Mouse y * @param {boolean} confine Whether confine tooltip content in view rect. diff --git a/src/coord/calendar/Calendar.js b/src/coord/calendar/Calendar.js index a055db32e..5eb93fb82 100644 --- a/src/coord/calendar/Calendar.js +++ b/src/coord/calendar/Calendar.js @@ -256,7 +256,7 @@ define(function (require) { /** * Convert a (x, y) point to time date * - * @param {string} point point + * @param {Array} point point * @return {Object} date */ pointToDate: function (point) { diff --git a/src/coord/cartesian/Grid.js b/src/coord/cartesian/Grid.js index ba1bd279b..2a6a8a448 100644 --- a/src/coord/cartesian/Grid.js +++ b/src/coord/cartesian/Grid.js @@ -190,7 +190,7 @@ define(function(require, factory) { /** * @param {string} axisType - * @param {ndumber} [axisIndex] + * @param {number} [axisIndex] */ gridProto.getAxis = function (axisType, axisIndex) { var axesMapOnDim = this._axesMap[axisType]; diff --git a/src/data/List.js b/src/data/List.js index a5461bcf7..11be5d767 100644 --- a/src/data/List.js +++ b/src/data/List.js @@ -983,7 +983,7 @@ define(function (require) { /** * Set layout property. - * @param {string} key + * @param {string|Object} key * @param {*} [val] */ listProto.setLayout = function (key, val) { diff --git a/src/data/Tree.js b/src/data/Tree.js index 0b8aff50a..6eaa7de6f 100644 --- a/src/data/Tree.js +++ b/src/data/Tree.js @@ -405,7 +405,7 @@ define(function(require) { * } * * @static - * @param {Objec} dataRoot Root node. + * @param {Object} dataRoot Root node. * @param {module:echarts/model/Model} hostModel * @param {Array.} levelOptions * @return module:echarts/data/Tree diff --git a/src/echarts.js b/src/echarts.js index df21e088b..246acc31a 100644 --- a/src/echarts.js +++ b/src/echarts.js @@ -114,7 +114,7 @@ define(function (require) { */ this.group; /** - * @type {HTMLDomElement} + * @type {HTMLElement} * @private */ this._dom = dom; @@ -228,7 +228,7 @@ define(function (require) { } }; /** - * @return {HTMLDomElement} + * @return {HTMLElement} */ echartsProto.getDom = function () { return this._dom; @@ -1564,7 +1564,7 @@ define(function (require) { } /** - * @param {HTMLDomElement} dom + * @param {HTMLElement} dom * @param {Object} [theme] * @param {Object} opts * @param {number} [opts.devicePixelRatio] Use window.devicePixelRatio by default @@ -1681,7 +1681,7 @@ define(function (require) { }; /** - * @param {HTMLDomElement} dom + * @param {HTMLElement} dom * @return {echarts~ECharts} */ echarts.getInstanceByDom = function (dom) { diff --git a/src/util/format.js b/src/util/format.js index 92a2d05dc..c7ec7039b 100644 --- a/src/util/format.js +++ b/src/util/format.js @@ -45,12 +45,12 @@ define(function (require) { * [4, 3, 2] => [4, 3, 2, 3] * @param {number|Array.} val */ - formatUtil.normalizeCssArray = function (val) { - var len = val.length; + formatUtil.normalizeCssArray = function (val) { if (typeof (val) === 'number') { return [val, val, val, val]; } - else if (len === 2) { + var len = val.length; + if (len === 2) { // vertical | horizontal return [val[0], val[1], val[0], val[1]]; } diff --git a/src/visual/VisualMapping.js b/src/visual/VisualMapping.js index 1805967b8..57bd97dde 100644 --- a/src/visual/VisualMapping.js +++ b/src/visual/VisualMapping.js @@ -471,7 +471,7 @@ define(function (require) { /** * @public * @param {Object} obj - * @return {Oject} new object containers visual values. + * @return {Object} new object containers visual values. * If no visuals, return null. */ VisualMapping.retrieveVisuals = function (obj) { diff --git a/test/chord.html b/test/chord.html index ac72debfe..b97ce6297 100644 --- a/test/chord.html +++ b/test/chord.html @@ -26,7 +26,7 @@ ], function (echarts) { var chart = echarts.init(document.getElementById('main')); - chart.setOption({ + chart.setOption({ tooltip: { trigger: 'axis', axisPointer: { @@ -36,7 +36,7 @@ series: [{ name: 'chord', type: 'chord', - sort: 'ascending', + sort: 'descending', data : [ {name : 'group1'}, {name : 'group2'}, -- GitLab