You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/06/22 10:44:17 UTC

[GitHub] [echarts] pissang commented on a change in pull request #15207: fix: hightlight multiple series not work as expected

pissang commented on a change in pull request #15207:
URL: https://github.com/apache/echarts/pull/15207#discussion_r656098723



##########
File path: src/core/echarts.ts
##########
@@ -1489,11 +1489,13 @@ class ECharts extends Eventful<ECEventDefinition> {
             }
 
             // If dispatchAction before setOption, do nothing.
-            ecModel && ecModel.eachComponent(condition, function (model) {
+            ecModel && ecModel.eachComponent(condition, function (model, modelIndex) {
                 if (!excludeSeriesIdMap || excludeSeriesIdMap.get(model.id) == null) {
                     if (isHighDownPayload(payload)) {
                         if (model instanceof SeriesModel) {
-                            if (payload.type === HIGHLIGHT_ACTION_TYPE && !payload.notBlur) {
+                            // only blur once
+                            const isFirstTimeBlur = modelIndex === 0;

Review comment:
       In some cases `modelndex` may not be `0`. It the index in the option. For example: if we change the test code to:
   ```ts
   chart.dispatchAction({
     type: 'highlight',
     seriesIndex: [1],
    });
   ```
   
   The `modelIndex` of the first iteration will be `1`. And no series will be blurred, which is not expected.
   
   I think a better solution is using a flag to check if any series triggers blur.
   
   
   There is another situation I think we need to consider:
   If we set `blurScope` to `series`. Only other data in the same series will be blurred. Should we still use the "only one series will trigger blur" policy? 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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