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/06/10 10:49:20 UTC

[incubator-echarts] branch fix/treemap-disalbe-hover-layer-by-default created (now 15e3ef0)

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

sushuang pushed a change to branch fix/treemap-disalbe-hover-layer-by-default
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git.


      at 15e3ef0  Prevent treamap from using hover layer by default. Fix #10521 . Ref #10635 .

This branch includes the following new commits:

     new 15e3ef0  Prevent treamap from using hover layer by default. Fix #10521 . Ref #10635 .

The 1 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.



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


[incubator-echarts] 01/01: Prevent treamap from using hover layer by default. Fix #10521 . Ref #10635 .

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sushuang pushed a commit to branch fix/treemap-disalbe-hover-layer-by-default
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit 15e3ef0ddcc5e7ffd45fe293f75400156f190422
Author: sushuang <su...@gmail.com>
AuthorDate: Mon Jun 10 18:47:42 2019 +0800

    Prevent treamap from using hover layer by default. Fix #10521 . Ref #10635 .
---
 src/chart/treemap/TreemapSeries.js |  3 ++-
 src/echarts.js                     | 25 ++++++++++++++++---------
 test/tooltip-axisPointer.html      |  8 +++++++-
 3 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/src/chart/treemap/TreemapSeries.js b/src/chart/treemap/TreemapSeries.js
index fca0174..be917ba 100644
--- a/src/chart/treemap/TreemapSeries.js
+++ b/src/chart/treemap/TreemapSeries.js
@@ -32,6 +32,8 @@ export default SeriesModel.extend({
 
     dependencies: ['grid', 'polar'],
 
+    preventUsingHoverLayer: true,
+
     /**
      * @type {module:echarts/data/Tree~Node}
      */
@@ -40,7 +42,6 @@ export default SeriesModel.extend({
     defaultOption: {
         // Disable progressive rendering
         progressive: 0,
-        hoverLayerThreshold: Infinity,
         // center: ['50%', '50%'],          // not supported in ec3.
         // size: ['80%', '80%'],            // deprecated, compatible with ec2.
         left: 'center',
diff --git a/src/echarts.js b/src/echarts.js
index bcbfddb..e6ab5f1 100644
--- a/src/echarts.js
+++ b/src/echarts.js
@@ -1500,7 +1500,7 @@ function renderSeries(ecIns, ecModel, api, payload, dirtyMap) {
     scheduler.unfinished |= unfinished;
 
     // If use hover layer
-    updateHoverLayerStatus(ecIns._zr, ecModel);
+    updateHoverLayerStatus(ecIns, ecModel);
 
     // Add aria
     aria(ecIns._zr.dom, ecModel);
@@ -1655,19 +1655,26 @@ echartsProto.dispose = function () {
 
 zrUtil.mixin(ECharts, Eventful);
 
-function updateHoverLayerStatus(zr, ecModel) {
+function updateHoverLayerStatus(ecIns, ecModel) {
+    var zr = ecIns._zr;
     var storage = zr.storage;
     var elCount = 0;
+
     storage.traverse(function (el) {
-        if (!el.isGroup) {
-            elCount++;
-        }
+        elCount++;
     });
+
     if (elCount > ecModel.get('hoverLayerThreshold') && !env.node) {
-        storage.traverse(function (el) {
-            if (!el.isGroup) {
-                // Don't switch back.
-                el.useHoverLayer = true;
+        ecModel.eachSeries(function (seriesModel) {
+            if (seriesModel.preventUsingHoverLayer) {
+                return;
+            }
+            var chartView = ecIns._chartsMap[seriesModel.__viewId];
+            if (chartView.__alive) {
+                chartView.group.traverse(function (el) {
+                    // Don't switch back.
+                    el.useHoverLayer = true;
+                });
             }
         });
     }
diff --git a/test/tooltip-axisPointer.html b/test/tooltip-axisPointer.html
index 4ae8da3..38adc91 100644
--- a/test/tooltip-axisPointer.html
+++ b/test/tooltip-axisPointer.html
@@ -460,7 +460,13 @@ under the License.
                     tooltip: {
                         trigger: 'axis',
                         axisPointer: {
-                            type: 'cross'
+                            type: 'cross',
+                            label: {
+                                formatter: function (params) {
+                                    console.log(params);
+                                    return 'asdfa';
+                                }
+                            }
                         }
                     }
                 };


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