You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2023/05/14 09:36:25 UTC

[echarts] branch fix/graph/edgeLabel-NPE created (now dfd95aa50)

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

wangzx pushed a change to branch fix/graph/edgeLabel-NPE
in repository https://gitbox.apache.org/repos/asf/echarts.git


      at dfd95aa50 chore: enable eslint cache.

This branch includes the following new commits:

     new a237e0a78 fix(graph): fix graph chart can't be hidden by legend due to edgeLabel NPE.
     new dfd95aa50 chore: enable eslint cache.

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.



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


[echarts] 02/02: chore: enable eslint cache.

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

wangzx pushed a commit to branch fix/graph/edgeLabel-NPE
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit dfd95aa50ac3b0af41817b3a247f10753506fc72
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Sun May 14 17:35:04 2023 +0800

    chore: enable eslint cache.
---
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package.json b/package.json
index b2ea0f963..b8e805298 100644
--- a/package.json
+++ b/package.json
@@ -58,7 +58,7 @@
     "mktest": "node test/build/mktest.js",
     "mktest:help": "node test/build/mktest.js -h",
     "checktype": "tsc --noEmit",
-    "lint": "npx eslint src/**/*.ts extension-src/**/*.ts",
+    "lint": "npx eslint --cache --cache-location node_modules/.cache/eslint src/**/*.ts extension-src/**/*.ts",
     "lint:fix": "npx eslint --fix src/**/*.ts extension-src/**/*.ts",
     "lint:dist": "echo 'It might take a while. Please wait ...' && npx jshint --config .jshintrc-dist dist/echarts.js"
   },


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


[echarts] 01/02: fix(graph): fix graph chart can't be hidden by legend due to edgeLabel NPE.

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

wangzx pushed a commit to branch fix/graph/edgeLabel-NPE
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit a237e0a781521fae6772f0549620cf72802a2714
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Sun May 14 17:20:28 2023 +0800

    fix(graph): fix graph chart can't be hidden by legend due to edgeLabel NPE.
---
 src/label/LabelManager.ts            | 12 +++++---
 test/graph-case.html                 | 60 +++++++++++++++++++++++++++++++++++-
 test/runTest/actions/__meta__.json   |  1 +
 test/runTest/actions/graph-case.json |  1 +
 4 files changed, 68 insertions(+), 6 deletions(-)

diff --git a/src/label/LabelManager.ts b/src/label/LabelManager.ts
index c1c7d9152..f2b2aefd3 100644
--- a/src/label/LabelManager.ts
+++ b/src/label/LabelManager.ts
@@ -487,10 +487,11 @@ class LabelManager {
 
             const defaultStyle: PathStyleProps = {};
             const visualStyle = data.getItemVisual(dataIndex, 'style');
-            const visualType = data.getVisual('drawType');
-            // Default to be same with main color
-            defaultStyle.stroke = visualStyle[visualType];
-
+            if (visualStyle) {
+                const visualType = data.getVisual('drawType');
+                // Default to be same with main color
+                defaultStyle.stroke = visualStyle[visualType];
+            }
             const labelLineModel = itemModel.getModel('labelLine');
 
             setLabelLineStyle(el, getLabelLineStatesModels(itemModel), defaultStyle);
@@ -591,4 +592,5 @@ class LabelManager {
 }
 
 
-export default LabelManager;
\ No newline at end of file
+export default LabelManager;
+
diff --git a/test/graph-case.html b/test/graph-case.html
index e6d311b41..7f199f5a4 100644
--- a/test/graph-case.html
+++ b/test/graph-case.html
@@ -38,7 +38,7 @@ under the License.
 
 
         <div id="main0"></div>
-
+        <div id="main1"></div>
 
 
 
@@ -95,6 +95,64 @@ under the License.
         });
         </script>
 
+        <script>
+            require(['echarts'], function (echarts) {
+                var option = {
+                    legend: {},
+                    series:   {
+                        type: 'graph',
+                        name: 'graph',
+                        edgeLabel: {
+                            show: true,
+                            fontSize: 16
+                        },
+                        lineStyle: {
+                            width: 5,
+                            curveness: 0.2,
+                            opacity: 0.9
+                        },
+                        data: [
+                            {
+                                x: 10,
+                                y: 100,
+                                name: 'Node 1'
+                            },
+                            {
+                                x: 100,
+                                y: -50,
+                                name: 'Node 2'
+                            },
+                            {
+                                x: 400,
+                                y: 200,
+                                name: 'Node 3'
+                            }
+                        ],
+                        links: [
+                            {
+                                source: 'Node 1',
+                                target: 'Node 2'
+                            },
+                            {
+                                source: 'Node 1',
+                                target: 'Node 3'
+                            },
+                            {
+                                source: 'Node 2',
+                                target: 'Node 3'
+                            }
+                        ]
+                    }
+                };
+
+                var chart = testHelper.create(echarts, 'main1', {
+                    title: [
+                        'Should not throw error when hiding by legend'
+                    ],
+                    option: option
+                });
+            });
+            </script>
 
     </body>
 </html>
diff --git a/test/runTest/actions/__meta__.json b/test/runTest/actions/__meta__.json
index b1cc9c96a..9f6155e61 100644
--- a/test/runTest/actions/__meta__.json
+++ b/test/runTest/actions/__meta__.json
@@ -100,6 +100,7 @@
   "geoScatter": 1,
   "getOption": 1,
   "graph": 2,
+  "graph-case": 1,
   "graph-grid": 1,
   "graph-simple": 2,
   "graphic-animation": 1,
diff --git a/test/runTest/actions/graph-case.json b/test/runTest/actions/graph-case.json
new file mode 100644
index 000000000..ace16dc41
--- /dev/null
+++ b/test/runTest/actions/graph-case.json
@@ -0,0 +1 @@
+[{"name":"Action 1","ops":[{"type":"mousemove","time":475,"x":416,"y":188},{"type":"mousemove","time":675,"x":406,"y":208},{"type":"mousedown","time":848,"x":406,"y":210},{"type":"mousemove","time":881,"x":406,"y":210},{"type":"mouseup","time":979,"x":406,"y":210},{"time":980,"delay":400,"type":"screenshot-auto"},{"type":"mousedown","time":1837,"x":406,"y":210},{"type":"mouseup","time":1988,"x":406,"y":210},{"time":1989,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":234 [...]
\ 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