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

wangzx pushed a commit to branch fix-markLine-label-tooltip
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit c54953c07b71a14d220fab8ca736088a3f1d3d4c
Author: plainheart <y...@all-my-life.cn>
AuthorDate: Tue May 3 04:30:13 2022 +0800

    fix(markLine): fix markLine label shows wrong tooltip content.
---
 src/component/marker/MarkLineView.ts  |  4 +++-
 test/marker-case.html                 | 42 +++++++++++++++++++++++++++++++++--
 test/runTest/actions/__meta__.json    |  1 +
 test/runTest/actions/marker-case.json |  1 +
 4 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/src/component/marker/MarkLineView.ts 
b/src/component/marker/MarkLineView.ts
index f907f146c..d3d6a661d 100644
--- a/src/component/marker/MarkLineView.ts
+++ b/src/component/marker/MarkLineView.ts
@@ -382,7 +382,9 @@ class MarkLineView extends MarkerView {
 
         // Set host model for tooltip
         // FIXME
-        mlData.line.eachItemGraphicEl(function (el, idx) {
+        mlData.line.eachItemGraphicEl(function (el) {
+            getECData(el).dataModel = mlModel;
+
             el.traverse(function (child) {
                 getECData(child).dataModel = mlModel;
             });
diff --git a/test/marker-case.html b/test/marker-case.html
index 756fa49dd..a02e9e1f6 100644
--- a/test/marker-case.html
+++ b/test/marker-case.html
@@ -38,7 +38,7 @@ under the License.
 
 
         <div id="main0"></div>
-
+        <div id="main1"></div>
 
 
 
@@ -105,7 +105,45 @@ under the License.
         });
         </script>
 
-
+        <script>
+            require([
+                'echarts',
+            ], function (echarts) {
+                var option = {
+                    tooltip: {
+                        trigger: 'item'
+                    },
+                    xAxis: {
+                        type: 'category',
+                        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+                    },
+                    yAxis: {
+                        type: 'value'
+                    },
+                    series: [
+                        {
+                            name: 'Highest',
+                            type: 'line',
+                            data: [10, 11, 13, 11, 12, 12, 9],
+                            lineStyle: {
+                                width: 0
+                            },
+                            showSymbol: false,
+                            markLine: {
+                                data: [{ type: 'average', name: 'Avg' }]
+                            }
+                        }
+                    ]
+                };
+
+                var chart = testHelper.create(echarts, 'main1', {
+                    title: [
+                        'Tooltip should show the same content when hovering on 
the line and the right label'
+                    ],
+                    option: option
+                });
+            });
+            </script>
     </body>
 </html>
 
diff --git a/test/runTest/actions/__meta__.json 
b/test/runTest/actions/__meta__.json
index 380a5f1da..f8becd518 100644
--- a/test/runTest/actions/__meta__.json
+++ b/test/runTest/actions/__meta__.json
@@ -134,6 +134,7 @@
   "map-province": 1,
   "mapWorld": 1,
   "markArea": 3,
+  "marker-case": 1,
   "media-dataZoom": 1,
   "media-finance": 2,
   "media-pie": 1,
diff --git a/test/runTest/actions/marker-case.json 
b/test/runTest/actions/marker-case.json
new file mode 100644
index 000000000..7c97b2ead
--- /dev/null
+++ b/test/runTest/actions/marker-case.json
@@ -0,0 +1 @@
+[{"name":"Action 
1","ops":[{"type":"screenshot","time":2416},{"type":"mousemove","time":3413,"x":681,"y":329},{"type":"mousemove","time":3613,"x":712,"y":345},{"type":"mousemove","time":3814,"x":737,"y":339},{"type":"mousemove","time":4015,"x":743,"y":328},{"type":"mousemove","time":5506,"x":743,"y":327},{"type":"screenshot","time":5524}],"scrollY":352,"scrollX":0,"timestamp":1651523314434}]
\ No newline at end of file


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

Reply via email to