You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/05/26 07:16:25 UTC

[incubator-echarts] branch label-enhancement updated (0bb61d0 -> ea1978b)

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

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


    from 0bb61d0  fix: exclude default stroke when intersecting labels.
     new 601259d  fix: fix hover scale in graph and tree
     new ea1978b  fix: use fill instead of textFIll for text

The 2 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/graph/GraphView.ts |  4 ++--
 src/chart/helper/Line.ts     |  2 +-
 src/chart/helper/Symbol.ts   | 29 +++++++++++++++++++----------
 src/chart/tree/TreeView.ts   |  4 ++--
 4 files changed, 24 insertions(+), 15 deletions(-)


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


[incubator-echarts] 01/02: fix: fix hover scale in graph and tree

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

shenyi pushed a commit to branch label-enhancement
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit 601259d75d48eaa7e8c2164f7d1207c86116dac8
Author: pissang <bm...@gmail.com>
AuthorDate: Tue May 26 15:15:42 2020 +0800

    fix: fix hover scale in graph and tree
---
 src/chart/graph/GraphView.ts |  4 ++--
 src/chart/helper/Symbol.ts   | 29 +++++++++++++++++++----------
 src/chart/tree/TreeView.ts   |  4 ++--
 3 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/src/chart/graph/GraphView.ts b/src/chart/graph/GraphView.ts
index e9e2559..f1dd3b1 100644
--- a/src/chart/graph/GraphView.ts
+++ b/src/chart/graph/GraphView.ts
@@ -448,8 +448,8 @@ class GraphView extends ChartView {
 
         const nodeScale = getNodeGlobalScale(seriesModel);
 
-        data.eachItemGraphicEl(function (el, idx) {
-            el.scaleX = el.scaleY = nodeScale;
+        data.eachItemGraphicEl(function (el: Symbol, idx) {
+            el.setSymbolScale(nodeScale);
         });
     }
 
diff --git a/src/chart/helper/Symbol.ts b/src/chart/helper/Symbol.ts
index 7bb3cd5..b67240a 100644
--- a/src/chart/helper/Symbol.ts
+++ b/src/chart/helper/Symbol.ts
@@ -46,8 +46,8 @@ class Symbol extends graphic.Group {
     /**
      * Original scale
      */
-    private _scaleX: number;
-    private _scaleY: number;
+    private _sizeX: number;
+    private _sizeY: number;
 
     private _z2: number;
 
@@ -174,8 +174,8 @@ class Symbol extends graphic.Group {
             const fadeIn = true;
 
             const target: PathProps = {
-                scaleX: this._scaleX,
-                scaleY: this._scaleY
+                scaleX: this._sizeX,
+                scaleY: this._sizeY
             };
             fadeIn && (target.style = {
                 opacity: symbolPath.style.opacity
@@ -276,16 +276,14 @@ class Symbol extends graphic.Group {
             return useNameLabel ? data.getName(idx) : getDefaultLabel(data, idx);
         }
 
-        this._scaleX = symbolSize[0] / 2;
-        this._scaleY = symbolSize[1] / 2;
+        this._sizeX = symbolSize[0] / 2;
+        this._sizeY = symbolSize[1] / 2;
 
         symbolPath.ensureState('emphasis').style = hoverItemStyle;
 
         if (hoverAnimation && seriesModel.isAnimationEnabled()) {
-            const scaleEmphasisState = this.ensureState('emphasis');
-            const scale = Math.max(1.1, 3 / this._scaleY + 1);
-            scaleEmphasisState.scaleX = scale;
-            scaleEmphasisState.scaleY = scale;
+            this.ensureState('emphasis');
+            this.setSymbolScale(1);
         }
         else {
             this.states.emphasis = null;
@@ -294,6 +292,17 @@ class Symbol extends graphic.Group {
         graphic.enableHoverEmphasis(this);
     }
 
+    setSymbolScale(scale: number) {
+        const emphasisState = this.states.emphasis;
+        if (emphasisState) {
+            const hoverScale = Math.max(scale * 1.1, 3 / this._sizeY + scale);
+            emphasisState.scaleX = hoverScale;
+            emphasisState.scaleY = hoverScale;
+        }
+
+        this.scaleX = this.scaleY = scale;
+    }
+
     fadeOut(cb: () => void, opt?: {
         keepLabel: boolean
     }) {
diff --git a/src/chart/tree/TreeView.ts b/src/chart/tree/TreeView.ts
index dc01b8b..0910809 100644
--- a/src/chart/tree/TreeView.ts
+++ b/src/chart/tree/TreeView.ts
@@ -358,8 +358,8 @@ class TreeView extends ChartView {
 
         const nodeScale = this._getNodeGlobalScale(seriesModel);
 
-        data.eachItemGraphicEl(function (el, idx) {
-            el.scaleX = el.scaleY = nodeScale;
+        data.eachItemGraphicEl(function (el: SymbolClz, idx) {
+            el.setSymbolScale(nodeScale);
         });
     }
 


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


[incubator-echarts] 02/02: fix: use fill instead of textFIll for text

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

shenyi pushed a commit to branch label-enhancement
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git

commit ea1978b4d0b6dee41a46d48cdcb1f9866a633050
Author: pissang <bm...@gmail.com>
AuthorDate: Tue May 26 15:16:05 2020 +0800

    fix: use fill instead of textFIll for text
---
 src/chart/helper/Line.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/chart/helper/Line.ts b/src/chart/helper/Line.ts
index 0ec7ce5..d67694d 100644
--- a/src/chart/helper/Line.ts
+++ b/src/chart/helper/Line.ts
@@ -277,7 +277,7 @@ class Line extends graphic.Group {
             // Only these properties supported in this emphasis style here.
             emphasisState.style = {
                 text: emphasisText as string,
-                textFill: hoverLabelModel.getTextColor(true),
+                fill: hoverLabelModel.getTextColor(true),
                 // For merging hover style to normal style, do not use
                 // `hoverLabelModel.getFont()` here.
                 fontStyle: hoverLabelModel.getShallow('fontStyle'),


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