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 2020/06/23 09:23:39 UTC

[GitHub] [incubator-echarts] zhouxin860114 edited a comment on issue #12831: echartsInstance. on事件中的参数query不生效

zhouxin860114 edited a comment on issue #12831:
URL: https://github.com/apache/incubator-echarts/issues/12831#issuecomment-648020816


   > > if you want watch the `legend` click event may be use [legendselectchanged](https://echarts.apache.org/zh/tutorial.html#ECharts%20%E4%B8%AD%E7%9A%84%E4%BA%8B%E4%BB%B6%E5%92%8C%E8%A1%8C%E4%B8%BA)?
   > > ![image](https://user-images.githubusercontent.com/5130528/85241938-1501d580-b470-11ea-868b-f3e6fbda2f5c.png)
   > 
   > 谢谢你的回答,但是我想要的是其他的鼠标事件,不一定只是点击事件.
   
   拿柱图自己做一个图例是不是可以?做了个简易的示例:
   [](https://gallery.echartsjs.com/editor.html?c=xeyxqD5RPy&v=1)
   
   ![image](https://user-images.githubusercontent.com/8022228/85386467-39e07080-b576-11ea-996f-0c494e43fa3d.png)
   
   ![image](https://user-images.githubusercontent.com/8022228/85386440-3220cc00-b576-11ea-8ab2-75192ae64bb5.png)
   
   
   ```myChart.on('click', {
       seriesName: 'myLegend'
   }, function(params) {
       console.log(123);
       console.log(params);
   
       if (params.color === '#CCC') {
           myChart.dispatchAction({
               type: 'legendSelect',
               // 图例名称
               name: params.name
           });
           option.series[params.seriesIndex].data[params.dataIndex].itemStyle.color = colorList[params.dataIndex];
           myChart.setOption(option);
   
       } else {
           myChart.dispatchAction({
               type: 'legendUnSelect',
               // 图例名称
               name: params.name
           });
           option.series[params.seriesIndex].data[params.dataIndex].itemStyle.color = '#CCC';
           myChart.setOption(option);
   
       }
   });```
   


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