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/07/03 02:17:24 UTC

[incubator-echarts] branch label-enhancement updated: fix(label): labelLine has same z, zlevel with element

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


The following commit(s) were added to refs/heads/label-enhancement by this push:
     new e629132  fix(label): labelLine has same z, zlevel with element
e629132 is described below

commit e629132e568e182b3a9cb602f61ef405bbeaf1db
Author: pissang <bm...@gmail.com>
AuthorDate: Fri Jul 3 10:16:43 2020 +0800

    fix(label): labelLine has same z, zlevel with element
---
 src/echarts.ts                | 16 +++++++++++-----
 src/label/labelGuideHelper.ts |  3 +--
 test/pie-label-mobile.html    | 10 ++++++++--
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/echarts.ts b/src/echarts.ts
index 4f76c11..9595ada 100644
--- a/src/echarts.ts
+++ b/src/echarts.ts
@@ -1854,13 +1854,19 @@ class ECharts extends Eventful {
                     zlevel != null && (el.zlevel = zlevel);
 
                     // TODO if textContent is on group.
-                    const textContent = el.getTextContent();
-                    if (textContent) {
-                        textContent.z = el.z;
-                        textContent.zlevel = el.zlevel;
+                    const label = el.getTextContent();
+                    const labelLine = el.getTextGuideLine();
+                    if (label) {
+                        label.z = el.z;
+                        label.zlevel = el.zlevel;
                         // lift z2 of text content
                         // TODO if el.emphasis.z2 is spcefied, what about textContent.
-                        textContent.z2 = el.z2 + 1;
+                        label.z2 = el.z2 + 1;
+                    }
+                    if (labelLine) {
+                        labelLine.z = el.z;
+                        labelLine.zlevel = el.zlevel;
+                        labelLine.z2 = el.z2 - 1;
                     }
                 }
             });
diff --git a/src/label/labelGuideHelper.ts b/src/label/labelGuideHelper.ts
index aea74d4..f089d30 100644
--- a/src/label/labelGuideHelper.ts
+++ b/src/label/labelGuideHelper.ts
@@ -520,8 +520,7 @@ function buildLabelLinePath(path: CanvasRenderingContext2D, shape: Polyline['sha
 export function setLabelLineStyle(
     targetEl: Element,
     statesModels: Record<typeof STATES[number], LabelLineModel>,
-    defaultStyle?: Polyline['style'],
-    defaultConfig?: Element['textGuideLineConfig']
+    defaultStyle?: Polyline['style']
 ) {
     let labelLine = targetEl.getTextGuideLine();
     const label = targetEl.getTextContent();
diff --git a/test/pie-label-mobile.html b/test/pie-label-mobile.html
index 15b5126..674e7b0 100644
--- a/test/pie-label-mobile.html
+++ b/test/pie-label-mobile.html
@@ -114,11 +114,16 @@ under the License.
                     series: [{
                         type: 'pie',
                         radius: [20, 60],
+                        itemStyle: {
+                            borderColor: '#fff',
+                            borderWidth: 1
+                        },
                         label: {
                             alignTo: 'edge',
-                            formatter: '{name|{b}}\n{time|{c}小时}',
+                            formatter: '{name|{b}}\n{time|{c} 小时}',
                             margin: 10,
                             lineHeight: 15,
+                            // color: 'inherit',
                             rich: {
                                 time: {
                                     fontSize: 10,
@@ -127,7 +132,8 @@ under the License.
                             }
                         },
                         labelLine: {
-                            length: 5
+                            length: 15,
+                            length2: 0
                         },
                         labelLayout: function (params) {
                             const isLeft = params.labelRect.x < chart.getWidth() / 2;


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