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/01/12 21:55:25 UTC

[incubator-echarts] branch master updated (e0393f2 -> 856a285)

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 e0393f2  Tweak
     new 2d5cc9b  migrate the fix of #9649 (e7a9e50) to release
     new c03ba8b  migrate the fix of #8943 (7ed2cb0)
     new d3c5dfb  Clean code.
     new 8dad11f  migrate the fix of #9657 (73af4bf)
     new 856a285  Merge branch 'release'

The 5 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:
 src/chart/sunburst/SunburstPiece.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


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


[incubator-echarts] 02/05: migrate the fix of #8943 (7ed2cb0)

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 c03ba8be18db60b5de29701906bdb84d7d396510
Author: sushuang <su...@gmail.com>
AuthorDate: Sun Jan 13 05:03:42 2019 +0800

    migrate the fix of #8943 (7ed2cb0)
---
 src/chart/sunburst/SunburstPiece.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/chart/sunburst/SunburstPiece.js b/src/chart/sunburst/SunburstPiece.js
index a79d66a..ed06d63 100644
--- a/src/chart/sunburst/SunburstPiece.js
+++ b/src/chart/sunburst/SunburstPiece.js
@@ -94,6 +94,8 @@ SunburstPieceProto.updateData = function (
 
     var visualColor = getNodeColor(node, seriesModel, ecModel);
 
+    fillDefaultColor(node, seriesModel, visualColor)
+
     var normalStyle = itemModel.getModel('itemStyle').getItemStyle();
     var style;
     if (state === 'normal') {
@@ -411,3 +413,9 @@ function isNodeHighlighted(node, activeNode, policy) {
         return node === activeNode || node.isDescendantOf(activeNode);
     }
 }
+
+// Fix tooltip callback function params.color incorrect when pick a default color 
+function fillDefaultColor(node, seriesModel, color) {
+    var data = seriesModel.getData();
+    data.setItemVisual(node.dataIndex, 'color', color);
+}


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


[incubator-echarts] 05/05: Merge branch 'release'

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 856a28568a5134b6ab1b3b40745e5e34ba69cb46
Merge: e0393f2 8dad11f
Author: sushuang <su...@gmail.com>
AuthorDate: Sun Jan 13 05:54:46 2019 +0800

    Merge branch 'release'
    
    # Conflicts:
    #	src/chart/pie/labelLayout.js
    #	src/chart/sunburst/SunburstPiece.js

 src/chart/sunburst/SunburstPiece.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


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


[incubator-echarts] 04/05: migrate the fix of #9657 (73af4bf)

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 8dad11fab204dbab758869556d96cae7fa63fec5
Author: sushuang <su...@gmail.com>
AuthorDate: Sun Jan 13 05:45:30 2019 +0800

    migrate the fix of #9657 (73af4bf)
---
 src/chart/pie/labelLayout.js | 33 +++++++++++++++++++--------------
 test/tmp-base.html           |  4 +---
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/src/chart/pie/labelLayout.js b/src/chart/pie/labelLayout.js
index e0b69b8..3244673 100644
--- a/src/chart/pie/labelLayout.js
+++ b/src/chart/pie/labelLayout.js
@@ -26,7 +26,6 @@ function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight) {
         return a.y - b.y;
     });
 
-    // 压
     function shiftDown(start, end, delta, dir) {
         for (var j = start; j < end; j++) {
             list[j].y += delta;
@@ -42,7 +41,6 @@ function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight) {
         shiftUp(end - 1, delta / 2);
     }
 
-    // 弹
     function shiftUp(end, delta) {
         for (var j = end; j >= 0; j--) {
             list[j].y -= delta;
@@ -56,18 +54,14 @@ function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight) {
 
     function changeX(list, isDownList, cx, cy, r, dir) {
         var lastDeltaX = dir > 0
-            ? isDownList                // 右侧
-                ? Number.MAX_VALUE      // 下
-                : 0                     // 上
-            : isDownList                // 左侧
-                ? Number.MAX_VALUE      // 下
-                : 0;                    // 上
+            ? isDownList                // right-side
+                ? Number.MAX_VALUE      // down
+                : 0                     // up
+            : isDownList                // left-side
+                ? Number.MAX_VALUE      // down
+                : 0;                    // up
 
         for (var i = 0, l = list.length; i < l; i++) {
-            // Not change x for center label
-            if (list[i].position === 'center') {
-                continue;
-            }
             var deltaY = Math.abs(list[i].y - cy);
             var length = list[i].len;
             var length2 = list[i].len2;
@@ -78,11 +72,11 @@ function adjustSingleSide(list, cx, cy, r, dir, viewWidth, viewHeight) {
                     )
                 : Math.abs(list[i].x - cx);
             if (isDownList && deltaX >= lastDeltaX) {
-                // 右下,左下
+                // right-down, left-down
                 deltaX = lastDeltaX - 10;
             }
             if (!isDownList && deltaX <= lastDeltaX) {
-                // 右上,左上
+                // right-up, left-up
                 deltaX = lastDeltaX + 10;
             }
 
@@ -122,6 +116,9 @@ function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight) {
     var leftList = [];
     var rightList = [];
     for (var i = 0; i < labelLayoutList.length; i++) {
+        if (isPositionCenter(labelLayoutList[i])) {
+            continue;
+        }
         if (labelLayoutList[i].x < cx) {
             leftList.push(labelLayoutList[i]);
         }
@@ -134,6 +131,9 @@ function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight) {
     adjustSingleSide(leftList, cx, cy, r, -1, viewWidth, viewHeight);
 
     for (var i = 0; i < labelLayoutList.length; i++) {
+        if (isPositionCenter(labelLayoutList[i])) {
+            continue;
+        }
         var linePoints = labelLayoutList[i].linePoints;
         if (linePoints) {
             var dist = linePoints[1][0] - linePoints[2][0];
@@ -149,6 +149,11 @@ function avoidOverlap(labelLayoutList, cx, cy, r, viewWidth, viewHeight) {
     }
 }
 
+function isPositionCenter(layout) {
+    // Not change x for center label
+    return layout.position === 'center';
+}
+
 export default function (seriesModel, r, viewWidth, viewHeight) {
     var data = seriesModel.getData();
     var labelLayoutList = [];
diff --git a/test/tmp-base.html b/test/tmp-base.html
index 3f3693c..fb3a3ba 100644
--- a/test/tmp-base.html
+++ b/test/tmp-base.html
@@ -44,8 +44,6 @@ under the License.
 
         <script>
 
-            var chart;
-            var myChart;
             var option;
 
             require([
@@ -55,7 +53,7 @@ under the License.
                 // $.getJSON('./data/nutrients.json', function (data) {
                 // });
 
-                chart = myChart = testHelper.create(echarts, 'main0', {
+                var chart = testHelper.create(echarts, 'main0', {
                     option: option
                 });
             });


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


[incubator-echarts] 01/05: migrate the fix of #9649 (e7a9e50) to release

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 2d5cc9b869eef69e27e4e5b0dac8e113910380a8
Author: sushuang <su...@gmail.com>
AuthorDate: Sun Jan 13 04:44:24 2019 +0800

    migrate the fix of #9649 (e7a9e50) to release
---
 src/echarts.js              | 12 ++++++---
 test/tooltip-setOption.html | 62 ++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 67 insertions(+), 7 deletions(-)

diff --git a/src/echarts.js b/src/echarts.js
index 41eb9a7..5851736 100644
--- a/src/echarts.js
+++ b/src/echarts.js
@@ -1506,7 +1506,7 @@ var MOUSE_EVENT_NAMES = [
  */
 echartsProto._initEvents = function () {
     each(MOUSE_EVENT_NAMES, function (eveName) {
-        this._zr.on(eveName, function (e) {
+        var handler = function (e) {
             var ecModel = this.getModel();
             var el = e.target;
             var params;
@@ -1575,8 +1575,14 @@ echartsProto._initEvents = function () {
 
                 this.trigger(eveName, params);
             }
-
-        }, this);
+        };
+        // Consider that some component (like tooltip, brush, ...)
+        // register zr event handler, but user event handler might
+        // do anything, such as call `setOption` or `dispatchAction`,
+        // which probably update any of the content and probably
+        // cause problem if it is called previous other inner handlers.
+        handler.zrEventfulCallAtLast = true;
+        this._zr.on(eveName, handler, this);
     }, this);
 
     each(eventActionMap, function (actionType, eventType) {
diff --git a/test/tooltip-setOption.html b/test/tooltip-setOption.html
index 3b1706d..deebf71 100644
--- a/test/tooltip-setOption.html
+++ b/test/tooltip-setOption.html
@@ -48,13 +48,13 @@ under the License.
         <div><a target="_blank" href="dynamicData.html">dynamicData.html</a></div>
         <div><a target="_blank" href="dynamicData2.html">dynamicData2.html</a></div>
         <div><a target="_blank" href="dynamicData3.html">dynamicData3.html</a></div>
-        <h1>triggerOn click setOption when trigger axis (keep show)</h1>
-        <!-- <div class="chart" id="click-setOption1"></div> -->
+        <h1>triggerOn: click, setOption when trigger axis (keep show)</h1>
+        <div class="chart" id="click-setOption1"></div>
 
 
         <h1>tooltip should auto show and auto disappear when setOption(..., {notMerge: true})</h1>
-        <div class="chart" id="setOption2">
-        </div>
+        <div class="chart" id="setOption2"></div>
+        <div class="chart" id="setOption3"></div>
 
 
 
@@ -180,5 +180,59 @@ under the License.
 
 
 
+
+
+
+        <script>
+            require(['echarts'], function (echarts) {
+                var colors = ['red', 'blue'];
+                var option = {
+                    color: colors,
+                    "tooltip": {
+                        "show": true
+                    },
+                    "xAxis": {
+                        "type": "category",
+                        "data": ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+                    },
+                    "yAxis": {
+                    },
+                    "series": [{
+                        "data": [820, 932, 901, 934, 1290, 1330, 1320],
+                        "type": 'bar'
+                    }, {
+                        "data": [620, 532, 501, 734, 1090, 1130, 1220],
+                        "type": 'bar'
+                    }]
+                };
+
+                var myChart = testHelper.create(echarts, 'setOption3', {
+                    title: 'Click the blue bar, should no error throw',
+                    option: option
+                });
+
+                myChart.on('click', function (params) {
+                    myChart.clear();
+                    myChart.setOption({
+                        "tooltip": {
+                            "show": true
+                        },
+                        "xAxis": {
+                            "type": "category",
+                            "data": ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+                        },
+                        "yAxis": {
+                        },
+                        "series": [{
+                            "data": [820, 932, 901, 934, 1290, 1330, 1320],
+                            "type": 'bar'
+                        }]
+                    });
+                });
+            });
+
+        </script>
+
+
     </body>
 </html>
\ No newline at end of file


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


[incubator-echarts] 03/05: Clean code.

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 d3c5dfb9c08c8d1383de2a9cd7d62babf340f7f6
Author: sushuang <su...@gmail.com>
AuthorDate: Sun Jan 13 05:05:08 2019 +0800

    Clean code.
---
 src/chart/sunburst/SunburstPiece.js | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/chart/sunburst/SunburstPiece.js b/src/chart/sunburst/SunburstPiece.js
index ed06d63..c7b73b5 100644
--- a/src/chart/sunburst/SunburstPiece.js
+++ b/src/chart/sunburst/SunburstPiece.js
@@ -86,15 +86,15 @@ SunburstPieceProto.updateData = function (
 
     var itemModel = node.getModel();
     var layout = node.getLayout();
-    if (!layout) {
-        console.log(node.getLayout());
-    }
+    // if (!layout) {
+    //     console.log(node.getLayout());
+    // }
     var sectorShape = zrUtil.extend({}, layout);
     sectorShape.label = null;
 
     var visualColor = getNodeColor(node, seriesModel, ecModel);
 
-    fillDefaultColor(node, seriesModel, visualColor)
+    fillDefaultColor(node, seriesModel, visualColor);
 
     var normalStyle = itemModel.getModel('itemStyle').getItemStyle();
     var style;
@@ -414,7 +414,7 @@ function isNodeHighlighted(node, activeNode, policy) {
     }
 }
 
-// Fix tooltip callback function params.color incorrect when pick a default color 
+// Fix tooltip callback function params.color incorrect when pick a default color
 function fillDefaultColor(node, seriesModel, color) {
     var data = seriesModel.getData();
     data.setItemVisual(node.dataIndex, 'color', color);


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