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

ovilia pushed a commit to branch release-dev
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit e14cc9a04bf01bd53047fe112993d5afd1053752
Author: Ovilia <[email protected]>
AuthorDate: Thu Jan 25 16:08:05 2024 +0800

    fix(ssr): hovering legend items should not trigger tooltip
    
    fix a bug introduced by #18381
---
 src/component/legend/LegendView.ts   | 28 ++++++++++++++++------------
 src/component/tooltip/TooltipView.ts |  5 +++++
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/component/legend/LegendView.ts 
b/src/component/legend/LegendView.ts
index e1c3bf710..35b0779f2 100644
--- a/src/component/legend/LegendView.ts
+++ b/src/component/legend/LegendView.ts
@@ -226,12 +226,14 @@ class LegendView extends ComponentView {
                     .on('mouseover', curry(dispatchHighlightAction, 
seriesModel.name, null, api, excludeSeriesId))
                     .on('mouseout', curry(dispatchDownplayAction, 
seriesModel.name, null, api, excludeSeriesId));
 
-                itemGroup.eachChild(child => {
-                    const ecData = getECData(child);
-                    ecData.seriesIndex = seriesModel.seriesIndex;
-                    ecData.dataIndex = dataIndex;
-                    ecData.ssrType = 'legend';
-                });
+                if (ecModel.ssr) {
+                    itemGroup.eachChild(child => {
+                        const ecData = getECData(child);
+                        ecData.seriesIndex = seriesModel.seriesIndex;
+                        ecData.dataIndex = dataIndex;
+                        ecData.ssrType = 'legend';
+                    });
+                }
 
                 legendDrawnMap.set(name, true);
             }
@@ -277,12 +279,14 @@ class LegendView extends ComponentView {
                             .on('mouseover', curry(dispatchHighlightAction, 
null, name, api, excludeSeriesId))
                             .on('mouseout', curry(dispatchDownplayAction, 
null, name, api, excludeSeriesId));
 
-                        itemGroup.eachChild(child => {
-                            const ecData = getECData(child);
-                            ecData.seriesIndex = seriesModel.seriesIndex;
-                            ecData.dataIndex = dataIndex;
-                            ecData.ssrType = 'legend';
-                        });
+                        if (ecModel.ssr) {
+                            itemGroup.eachChild(child => {
+                                const ecData = getECData(child);
+                                ecData.seriesIndex = seriesModel.seriesIndex;
+                                ecData.dataIndex = dataIndex;
+                                ecData.ssrType = 'legend';
+                            });
+                        }
 
                         legendDrawnMap.set(name, true);
                     }
diff --git a/src/component/tooltip/TooltipView.ts 
b/src/component/tooltip/TooltipView.ts
index 461db0174..2a6f55f09 100644
--- a/src/component/tooltip/TooltipView.ts
+++ b/src/component/tooltip/TooltipView.ts
@@ -463,6 +463,11 @@ class TooltipView extends ComponentView {
             this._showAxisTooltip(dataByCoordSys, e);
         }
         else if (el) {
+            const ecData = getECData(el);
+            if (ecData.ssrType === 'legend') {
+                // Don't trigger tooltip for legend tooltip item
+                return;
+            }
             this._lastDataByCoordSys = null;
 
             let seriesDispatcher: Element;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to