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 2018/04/22 23:20:41 UTC

[incubator-echarts] branch master updated (39e7ad1 -> 66f88dd)

This is an automated email from the ASF dual-hosted git repository.

sushuang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git.


    from 39e7ad1  Make brushed elements higher than normal elements on z, avoiding them be overlapped by normal elements.
     new bd9403e  tweak
     new 157e961  Fix task when multiple progress.
     new 66f88dd  tweak cases and code check.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .jshintrc-dist                            |   2 +-
 src/component/toolbox/feature/DataZoom.js |   2 +
 src/layout/barGrid.js                     |   3 +-
 src/stream/Scheduler.js                   |  23 ++--
 src/stream/task.js                        |  30 +++--
 src/util/format.js                        |   6 +-
 test/custom-bmap-polygon.html             |   2 +-
 test/custom-children-remove.html          | 193 ++++++++++++++----------------
 test/dataZoom-rainfall-inside.html        |   2 +-
 test/graphicRemove.html                   |  35 +++---
 10 files changed, 154 insertions(+), 144 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
sushuang@apache.org.

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[incubator-echarts] 02/03: Fix task when multiple progress.

Posted by su...@apache.org.
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

commit 157e96108025d1420eebaa867d2890d27b3552a0
Author: sushuang <su...@gmail.com>
AuthorDate: Mon Apr 23 05:46:04 2018 +0800

    Fix task when multiple progress.
---
 src/stream/Scheduler.js | 21 ++++++++++++---------
 src/stream/task.js      | 30 ++++++++++++++++++++++--------
 2 files changed, 34 insertions(+), 17 deletions(-)

diff --git a/src/stream/Scheduler.js b/src/stream/Scheduler.js
index 19b3e4a..ed7f438 100644
--- a/src/stream/Scheduler.js
+++ b/src/stream/Scheduler.js
@@ -2,7 +2,7 @@
  * @module echarts/stream/Scheduler
  */
 
-import {each, isFunction, createHashMap, noop} from 'zrender/src/core/util';
+import {each, map, isArray, isFunction, createHashMap, noop} from 'zrender/src/core/util';
 import {createTask} from './task';
 import {getUID} from '../util/component';
 import GlobalModel from '../model/Global';
@@ -444,17 +444,20 @@ function seriesTaskReset(context) {
     var resetDefines = context.resetDefines = normalizeToArray(context.reset(
         context.model, context.ecModel, context.api, context.payload
     ));
-    if (resetDefines.length) {
-        return seriesTaskProgress;
-    }
+    return resetDefines.length > 1
+        ? map(resetDefines, function (v, idx) {
+            return makeSeriesTaskProgress(idx);
+        })
+        : singleSeriesTaskProgress;
 }
 
-function seriesTaskProgress(params, context) {
-    var data = context.data;
-    var resetDefines = context.resetDefines;
+var singleSeriesTaskProgress = makeSeriesTaskProgress(0);
+
+function makeSeriesTaskProgress(resetDefineIdx) {
+    return function (params, context) {
+        var data = context.data;
+        var resetDefine = context.resetDefines[resetDefineIdx];
 
-    for (var k = 0; k < resetDefines.length; k++) {
-        var resetDefine = resetDefines[k];
         if (resetDefine && resetDefine.dataEach) {
             for (var i = params.start; i < params.end; i++) {
                 resetDefine.dataEach(data, i);
diff --git a/src/stream/task.js b/src/stream/task.js
index e1d19bc..3928e1f 100644
--- a/src/stream/task.js
+++ b/src/stream/task.js
@@ -1,4 +1,4 @@
-import {assert} from 'zrender/src/core/util';
+import {assert, isArray} from 'zrender/src/core/util';
 import { __DEV__ } from '../config';
 
 /**
@@ -113,10 +113,15 @@ taskProto.perform = function (performArgs) {
         );
 
         if (!skip && (forceFirstProgress || start < end)) {
-            iterator.reset(start, end, modBy, modDataCount);
-            this._progress({
-                start: start, end: end, step: 1, count: end - start, next: iterator.next
-            }, this.context);
+            var progress = this._progress;
+            if (isArray(progress)) {
+                for (var i = 0; i < progress.length; i++) {
+                    doProgress(this, progress[i], start, end, modBy, modDataCount);
+                }
+            }
+            else {
+                doProgress(this, progress, start, end, modBy, modDataCount);
+            }
         }
 
         this._dueIndex = end;
@@ -189,9 +194,14 @@ taskProto.dirty = function () {
     this._onDirty && this._onDirty(this.context);
 };
 
-/**
- * @param {Object} [params]
- */
+function doProgress(taskIns, progress, start, end, modBy, modDataCount) {
+    iterator.reset(start, end, modBy, modDataCount);
+    taskIns._callingProgress = progress;
+    taskIns._callingProgress({
+        start: start, end: end, count: end - start, next: iterator.next
+    }, taskIns.context);
+}
+
 function reset(taskIns, skip) {
     taskIns._dueIndex = taskIns._outputDueEnd = taskIns._dueEnd = 0;
     taskIns._settedOutputEnd = null;
@@ -205,6 +215,10 @@ function reset(taskIns, skip) {
             forceFirstProgress = progress.forceFirstProgress;
             progress = progress.progress;
         }
+        // To simplify no progress checking, array must has item.
+        if (isArray(progress) && !progress.length) {
+            progress = null;
+        }
     }
 
     taskIns._progress = progress;

-- 
To stop receiving notification emails like this one, please contact
sushuang@apache.org.

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[incubator-echarts] 03/03: tweak cases and code check.

Posted by su...@apache.org.
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

commit 66f88ddae97f598467178165c08e932e5705d36a
Author: sushuang <su...@gmail.com>
AuthorDate: Mon Apr 23 07:20:18 2018 +0800

    tweak cases and code check.
---
 .jshintrc-dist                            |   2 +-
 src/component/toolbox/feature/DataZoom.js |   2 +
 src/stream/Scheduler.js                   |   2 +-
 src/util/format.js                        |   6 +-
 test/custom-bmap-polygon.html             |   2 +-
 test/custom-children-remove.html          | 193 ++++++++++++++----------------
 test/dataZoom-rainfall-inside.html        |   2 +-
 test/graphicRemove.html                   |  35 +++---
 8 files changed, 118 insertions(+), 126 deletions(-)

diff --git a/.jshintrc-dist b/.jshintrc-dist
index ecc42d4..e9fd7f7 100644
--- a/.jshintrc-dist
+++ b/.jshintrc-dist
@@ -1,6 +1,6 @@
 {
     "bitwise": false,
-    "camelcase": true,
+    "camelcase": false,
     "curly": true,
     "eqeqeq": false,
     "forin": false,
diff --git a/src/component/toolbox/feature/DataZoom.js b/src/component/toolbox/feature/DataZoom.js
index b4695de..dade91a 100644
--- a/src/component/toolbox/feature/DataZoom.js
+++ b/src/component/toolbox/feature/DataZoom.js
@@ -251,6 +251,8 @@ echarts.registerPreprocessor(function (option) {
 
         if (toolboxOpt && toolboxOpt.feature) {
             var dataZoomOpt = toolboxOpt.feature.dataZoom;
+            // FIXME: If add dataZoom when setOption in merge mode,
+            // no axis info to be added. See `test/dataZoom-extreme.html`
             addForAxis('xAxis', dataZoomOpt);
             addForAxis('yAxis', dataZoomOpt);
         }
diff --git a/src/stream/Scheduler.js b/src/stream/Scheduler.js
index ed7f438..6c226e6 100644
--- a/src/stream/Scheduler.js
+++ b/src/stream/Scheduler.js
@@ -466,7 +466,7 @@ function makeSeriesTaskProgress(resetDefineIdx) {
         else if (resetDefine && resetDefine.progress) {
             resetDefine.progress(params, data);
         }
-    }
+    };
 }
 
 function seriesTaskCount(context) {
diff --git a/src/util/format.js b/src/util/format.js
index b16f616..3cc7a1c 100644
--- a/src/util/format.js
+++ b/src/util/format.js
@@ -42,14 +42,14 @@ var replaceMap = {
     '<': '&lt;',
     '>': '&gt;',
     '"': '&quot;',
-    '\'': '&#39;',
+    '\'': '&#39;'
 };
 
 export function encodeHTML(source) {
     return source == null
         ? ''
-        : (source + '').replace(replaceReg, function (str, char) {
-            return replaceMap[char];
+        : (source + '').replace(replaceReg, function (str, c) {
+            return replaceMap[c];
         });
 }
 
diff --git a/test/custom-bmap-polygon.html b/test/custom-bmap-polygon.html
index 44760ef..11e65a9 100644
--- a/test/custom-bmap-polygon.html
+++ b/test/custom-bmap-polygon.html
@@ -461,7 +461,7 @@
                 var myChart = echarts.init(document.getElementById('main'));
 
                 myChart.setOption({
-                    backgroundColor: '#404a59',
+                    // backgroundColor: '#404a59',
                     title: {
                         text: '全国主要城市空气质量',
                         subtext: 'data from PM25.in',
diff --git a/test/custom-children-remove.html b/test/custom-children-remove.html
index abb3cd0..d6949f2 100644
--- a/test/custom-children-remove.html
+++ b/test/custom-children-remove.html
@@ -42,115 +42,100 @@
 
             require([
                 'echarts'
-                // 'echarts/chart/line',
-                // 'echarts/chart/bar',
-                // 'echarts/chart/pie',
-                // 'echarts/chart/scatter',
-                // 'echarts/chart/custom',
-                // '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 (ec) {
                 echarts = ec;
                 chart = myChart = echarts.init(document.getElementById('main'));
 
-var data = [
-    {name:'广州', value: 50},
-    {name:'深圳', value: 72},
-    {name:'珠海', value: 30},
-    {name:'佛山', value: 38},
-    {name:'杭州', value: 42},
-    {name:'舟山', value: 32},
-    {name:'宁波', value: 52}
-];
-
-
-option = {
-    tooltip : {
-        trigger: 'item'
-    },
-    legend: {
-        data:['广州','深圳','珠海','佛山','杭州','舟山','宁波'],
-        top: 0,
-        left: 'center'
-    },
-    xAxis : [
-        {
-            type : 'category',
-            data : [0],
-            axisTick: {show: false},
-            axisLabel: {show: false}
-        },
-    ],
-    yAxis : [
-        {
-            type : 'value'
-        }
-    ],
-    series : echarts.util.map(data, function (item) {
-        return {
-            name: item.name,
-            type: 'bar',
-            label: {
-                normal: {
-                    show: true,
-                    position: 'bottom',
-                    formatter: function (param) {
-                        return param.seriesName;
-                    }
+                var data = [
+                    {name:'广州', value: 50},
+                    {name:'深圳', value: 72},
+                    {name:'珠海', value: 30},
+                    {name:'佛山', value: 38},
+                    {name:'杭州', value: 42},
+                    {name:'舟山', value: 32},
+                    {name:'宁波', value: 52}
+                ];
+
+
+                option = {
+                    tooltip : {
+                        trigger: 'item'
+                    },
+                    legend: {
+                        data:['广州','深圳','珠海','佛山','杭州','舟山','宁波'],
+                        top: 0,
+                        left: 'center'
+                    },
+                    xAxis : [
+                        {
+                            type : 'category',
+                            data : [0],
+                            axisTick: {show: false},
+                            axisLabel: {show: false}
+                        },
+                    ],
+                    yAxis : [
+                        {
+                            type : 'value'
+                        }
+                    ],
+                    series : echarts.util.map(data, function (item) {
+                        return {
+                            name: item.name,
+                            type: 'bar',
+                            label: {
+                                normal: {
+                                    show: true,
+                                    position: 'bottom',
+                                    formatter: function (param) {
+                                        return param.seriesName;
+                                    }
+                                }
+                            },
+                            data: [item.value]
+                        }
+                    }).concat([{
+                        type: 'custom',
+                        renderItem: renderProvinceName,
+                        data: [0]
+                    }])
+                };
+
+                function renderProvinceName(param, api) {
+                    var currentSeriesIndices = api.currentSeriesIndices();
+                    currentSeriesIndices.pop(); // remove custom series;
+
+                    var barLayout = api.barLayout({
+                        barGap: '30%', barCategoryGap: '20%', count: currentSeriesIndices.length
+                    });
+
+                    var nameTexts = echarts.util.map(currentSeriesIndices, function (serIdx, index) {
+                        var point = api.coord([0, 0]);
+                        point[0] += barLayout[index].offsetCenter;
+                        point[1] = api.getHeight() - 20;
+
+                        return {
+                            position: point,
+                            name: serIdx,
+                            type: 'circle',
+                            shape: {
+                                cx: 0, cy: 0, r: 10
+                            },
+                            style: {
+                                text: serIdx,
+                                fill: '#333',
+                                textFill: '#eee',
+                                stroke: null
+                            }
+                        };
+                    });
+
+                    return {
+                        type: 'group',
+                        diffChildrenByName: true,
+                        children: nameTexts
+                    };
                 }
-            },
-            data: [item.value]
-        }
-    }).concat([{
-        type: 'custom',
-        renderItem: renderProvinceName,
-        data: [0]
-    }])
-};
-
-function renderProvinceName(param, api) {
-    var currentSeriesIndices = api.currentSeriesIndices();
-    currentSeriesIndices.pop(); // remove custom series;
-
-    var barLayout = api.barLayout({
-        barGap: '30%', barCategoryGap: '20%', count: currentSeriesIndices.length
-    });
-
-    var nameTexts = echarts.util.map(currentSeriesIndices, function (serIdx, index) {
-        var point = api.coord([0, 0]);
-        point[0] += barLayout[index].offsetCenter;
-        point[1] = api.getHeight() - 20;
-
-        return {
-            position: point,
-            name: serIdx,
-            type: 'circle',
-            shape: {
-                cx: 0, cy: 0, r: 10
-            },
-            style: {
-                text: serIdx,
-                fill: '#333',
-                stroke: null
-            }
-        };
-    });
-
-    return {
-        type: 'group',
-        diffChildrenByName: true,
-        children: nameTexts
-    };
-}
 
                 chart.setOption(option);
             });
diff --git a/test/dataZoom-rainfall-inside.html b/test/dataZoom-rainfall-inside.html
index 792c59d..3161247 100644
--- a/test/dataZoom-rainfall-inside.html
+++ b/test/dataZoom-rainfall-inside.html
@@ -25,7 +25,7 @@
 
         <h1>rainfall</h1>
         <div class="chart" id="rainfall"></div>
-        <h1>zoom lock | Should not prevent default when mouse wheel.</h1>
+        <h1>zoom lock (only inside) | Should not prevent default when mouse wheel.</h1>
         <div class="chart" id="zoom-lock"></div>
         <h1>zoomOnMouseWheel: 'shift', moveOnMouseMove: 'alt' | Should not prevent default when mouse wheel.</h1>
         <div class="chart" id="zoom-shift"></div>
diff --git a/test/graphicRemove.html b/test/graphicRemove.html
index 4b488df..2432522 100644
--- a/test/graphicRemove.html
+++ b/test/graphicRemove.html
@@ -51,13 +51,13 @@
                         id: 'text1',
                         type: 'rect',
                         shape: {
-                            x:0,
-                            y:0,
+                            x: 0,
+                            y: 0,
                             width: 100,
                             height: 100,
-                            },
-                            style: {
-                            fill: 'red',
+                        },
+                        style: {
+                            fill: 'red'
                         }
                     }
                 };
@@ -82,20 +82,25 @@
                     // });
                     // 删除后再添加。
                     myChart.setOption({
-                        id: 'text1',
-                        type: 'rect',
-                        shape: {
-                            x:0,
-                            y:0,
-                            width: 100,
-                            height: 100,
-                        },
-                        style: {
-                            fill: 'red',
+                        graphic: {
+                            id: 'text1',
+                            type: 'rect',
+                            shape: {
+                                x:0,
+                                y:0,
+                                width: 100,
+                                height: 100,
+                            },
+                            style: {
+                                fill: 'red',
+                            }
                         }
                     });
                 }, 1000);
 
+
+                document.getElementById('wid').innerText = window.innerWidth;
+
                 var hasRect;
 
                 window.onresize = function() {

-- 
To stop receiving notification emails like this one, please contact
sushuang@apache.org.

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[incubator-echarts] 01/03: tweak

Posted by su...@apache.org.
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

commit bd9403e52a0ae87c929229509225910d6888690f
Author: sushuang <su...@gmail.com>
AuthorDate: Mon Apr 23 04:39:27 2018 +0800

    tweak
---
 src/layout/barGrid.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/layout/barGrid.js b/src/layout/barGrid.js
index 2dab497..51eeff4 100644
--- a/src/layout/barGrid.js
+++ b/src/layout/barGrid.js
@@ -223,8 +223,9 @@ export function retrieveColumnLayout(barWidthAndOffset, axis, seriesModel) {
     if (barWidthAndOffset && axis) {
         var result = barWidthAndOffset[getAxisKey(axis)];
         if (result != null && seriesModel != null) {
-            return result[getSeriesStackId(seriesModel)];
+            result = result[getSeriesStackId(seriesModel)];
         }
+        return result;
     }
 }
 

-- 
To stop receiving notification emails like this one, please contact
sushuang@apache.org.

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org