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

2021-03-29 Thread GitBox


14glwu commented on issue #13828:
URL: https://github.com/apache/echarts/issues/13828#issuecomment-809141838


   > > > 讲一下我最后的解决办法,仅供参考,非必要不建议改源码
   > > > 图表联动,本质是某一图表触发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
   > > > // 原有逻辑 
   > > >   });
   > > > });
   > > > ```
   > > 
   > > 
   > > 你这个是修改源码了么
   > 
   > 是的,不建议改源码,我们是项目里有多处需要改的,就一并改了
   
   我看了下echarts源码找到了一种新的解决办法,就是使用batch方式,这样可以使用到escapeConnect属性
   
![image](https://user-images.githubusercontent.com/26249572/112801390-6b591000-90a3-11eb-809d-4391dbaec9e7.png)
   `chartInstance.dispatchAction({
 type: 'legendUnSelect',
 escapeConnect: true,
 batch: [
   {
 name: key,
 selected: legendsSelected,
   },
 ],
   });`


-- 
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:
us...@infra.apache.org



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



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

2021-03-28 Thread GitBox


14glwu commented on issue #13828:
URL: https://github.com/apache/echarts/issues/13828#issuecomment-809046680


   > 讲一下我最后的解决办法,仅供参考,非必要不建议改源码
   > 
   > 图表联动,本质是某一图表触发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:
us...@infra.apache.org



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



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

2021-03-28 Thread GitBox


14glwu commented on issue #13828:
URL: https://github.com/apache/echarts/issues/13828#issuecomment-809039964


   > 
https://github.com/apache/incubator-echarts/blob/master/test/connect-manually.html
 可以参考这个例子,手动触发 connect
   
   或者能否支持这样传入escapeConnect来避免被联动?
   `chartInstance.dispatchAction({ type: 'legendSelect', name: 'test', 
escapeConnect: true });`


-- 
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:
us...@infra.apache.org



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



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

2021-03-28 Thread GitBox


14glwu commented on issue #13828:
URL: https://github.com/apache/echarts/issues/13828#issuecomment-808870915


   > 
https://github.com/apache/incubator-echarts/blob/master/test/connect-manually.html
 可以参考这个例子,手动触发 connect
   
   但是这个不是很方便,我还是赞同楼主的说法,联动的时候有没有办法设置哪些事件支持联动


-- 
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:
us...@infra.apache.org



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



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

2021-03-28 Thread GitBox


14glwu commented on issue #13828:
URL: https://github.com/apache/echarts/issues/13828#issuecomment-808870875


   > 
https://github.com/apache/incubator-echarts/blob/master/test/connect-manually.html
 可以参考这个例子,手动触发 connect
   
   但是这个不是很方便,我还是赞同楼主的说法,联动的时候有没有办法设置哪些事件支持联动


-- 
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:
us...@infra.apache.org



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