This is an automated email from the ASF dual-hosted git repository. sushuang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/master by this push: new 2fddc7f Fix #8003 (yAxis extent do not updated when some of stacked bar series hide) 2fddc7f is described below commit 2fddc7fd0463aac23652d1e3eefb7b28411f467a Author: sushuang <sushuang0...@gmail.com> AuthorDate: Thu Apr 19 03:47:35 2018 +0800 Fix #8003 (yAxis extent do not updated when some of stacked bar series hide) --- src/data/List.js | 35 ++++++++++++++++++++------------- test/bar-stack.html | 47 ++++++-------------------------------------- test/candlestick-large2.html | 4 ++-- test/lib/reset.css | 3 ++- 4 files changed, 31 insertions(+), 58 deletions(-) diff --git a/src/data/List.js b/src/data/List.js index 2ee3f69..688e3b6 100644 --- a/src/data/List.js +++ b/src/data/List.js @@ -47,21 +47,29 @@ function cloneChunk(originalChunk) { } var TRANSFERABLE_PROPERTIES = [ - 'hasItemOption', '_nameList', '_idList', '_calculationInfo', '_invertedIndicesMap', - '_rawData', '_rawExtent', '_chunkSize', '_chunkCount', - '_dimValueGetter', '_count', '_rawCount', '_nameDimIdx', '_idDimIdx' + 'hasItemOption', '_nameList', '_idList', '_invertedIndicesMap', + '_rawData', '_chunkSize', '_chunkCount', '_dimValueGetter', + '_count', '_rawCount', '_nameDimIdx', '_idDimIdx' +]; +var CLONE_PROPERTIES = [ + '_extent', '_approximateExtent', '_rawExtent' ]; -function transferProperties(a, b) { - zrUtil.each(TRANSFERABLE_PROPERTIES.concat(b.__wrappedMethods || []), function (propName) { - if (b.hasOwnProperty(propName)) { - a[propName] = b[propName]; +function transferProperties(target, source) { + zrUtil.each(TRANSFERABLE_PROPERTIES.concat(source.__wrappedMethods || []), function (propName) { + if (source.hasOwnProperty(propName)) { + target[propName] = source[propName]; } }); - a.__wrappedMethods = b.__wrappedMethods; -} + target.__wrappedMethods = source.__wrappedMethods; + + zrUtil.each(CLONE_PROPERTIES, function (propName) { + target[propName] = zrUtil.clone(source[propName]); + }); + target._calculationInfo = zrUtil.extend(source._calculationInfo); +} @@ -1441,15 +1449,17 @@ function cloneListForMapAndSample(original, excludeDimensions) { var storage = list._storage = {}; var originalStorage = original._storage; - var rawExtent = zrUtil.extend({}, original._rawExtent); // Init storage for (var i = 0; i < allDimensions.length; i++) { var dim = allDimensions[i]; if (originalStorage[dim]) { + // Notice that we do not reset invertedIndicesMap here, becuase + // there is no scenario of mapping or sampling ordinal dimension. if (zrUtil.indexOf(excludeDimensions, dim) >= 0) { storage[dim] = cloneDimStore(originalStorage[dim]); - rawExtent[dim] = getInitialExtent(); + list._rawExtent[dim] = getInitialExtent(); + list._extent[dim] = null; } else { // Direct reference for other dimensions @@ -1855,9 +1865,6 @@ listProto.cloneShallow = function (list) { } list.getRawIndex = list._indices ? getRawIndexWithIndices : getRawIndexWithoutIndices; - list._extent = zrUtil.clone(this._extent); - list._approximateExtent = zrUtil.clone(this._approximateExtent); - return list; }; diff --git a/test/bar-stack.html b/test/bar-stack.html index 3503408..59e554d 100644 --- a/test/bar-stack.html +++ b/test/bar-stack.html @@ -12,57 +12,19 @@ </head> <body> <style> - h1 { - line-height: 60px; - height: 60px; - background: #146402; - text-align: center; - font-weight: bold; - color: #eee; - font-size: 14px; - } - .chart { - height: 500px; - } </style> - <div class="chart" id="main0"></div> - - + <div id="main0"></div> <script> require([ 'echarts' - // 'echarts/chart/line', - // 'echarts/chart/bar', - // 'echarts/chart/pie', - // 'echarts/chart/scatter', - // 'echarts/chart/map', - // 'echarts/chart/parallel', - // 'echarts/chart/radar', - // 'echarts/component/grid', - // 'echarts/component/polar', - // 'echarts/component/geo', - // 'echarts/component/singleAxis', - // 'echarts/component/legend', - // 'echarts/component/tooltip', - // 'echarts/component/toolbox', - // 'echarts/component/visualMap', - // 'echarts/component/dataZoom' ], function (echarts) { var option = { - "title": { - "text": "简单柱状图标题", - "left": 16, - "textStyle": { - "fontSize": 14 - }, - "show": true - }, "tooltip": { "trigger": "axis", "axisPointer": { @@ -128,7 +90,7 @@ "data": [ ["哪有那么多审批", 66], ["审批中", 66], - ["撤回",200], + ["撤回",150], ["barMinHeight:10px", 100] ], "name": "zly0031" @@ -142,7 +104,10 @@ } }; - testHelper.createChart(echarts, 'main0', option); + testHelper.create(echarts, 'main0', { + title: 'Click the first legend (to hide the bottom series), yAxis extent should be changed', + option: option + }); }); </script> diff --git a/test/candlestick-large2.html b/test/candlestick-large2.html index 9a8262b..0686048 100644 --- a/test/candlestick-large2.html +++ b/test/candlestick-large2.html @@ -235,10 +235,10 @@ dimension: 6, pieces: [{ value: 1, - color: downColor + color: upColor }, { value: -1, - color: upColor + color: downColor }] }, series: [ diff --git a/test/lib/reset.css b/test/lib/reset.css index 02adc19..117d916 100644 --- a/test/lib/reset.css +++ b/test/lib/reset.css @@ -12,7 +12,8 @@ body > .main { .test-title { padding: 20px; - background: rgb(182, 120, 7); + background: #0a6d01; + /* background: rgb(182, 120, 7); */ color: #fff; font-weight: normal; text-align: center; -- To stop receiving notification emails like this one, please contact sushu...@apache.org. --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org