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/03/29 03:40:42 UTC

[GitHub] [echarts] zhaoxuhui1122 commented on issue #13828: 页面内多图表实例联动场景下,如何关闭个别属性联动,例如关闭tooltip联动,其他行为联动保持正常

zhaoxuhui1122 commented on issue #13828:
URL: https://github.com/apache/echarts/issues/13828#issuecomment-809043620


   讲一下我最后的解决办法,仅供参考,非必要不建议改源码
   
   图表联动,本质是某一图表触发action时,遍历当前group内的图表,dispatch对应的action,
   
   解决的思路为,在遍历group,触发action前,判断`eventType`是否需要联动,不需要则不触发action
   
   
   解决方法:
   - 图表配置`options`内增加要排除的联动属性 `disabledConnectEventTypes`, `string []`
   - 在这个方法内,判断如果是不需要联动的属性,不触发action
   ```js
       each(eventActionMap, function (actionType, eventType) {
         chart._messageCenter.on(eventType, function (event) {
           var options = chart._model.option;
           // 过滤不需要联动的actionType
           var disabledConnectEventTypes = _.get(chart, '_model.option.customConf.disabledConnectEventTypes', []);
           if (disabledConnectEventTypes.includes(eventType)) return
           // 原有逻辑 ....
         });
       });
   ```


-- 
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