You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/09/13 07:29:05 UTC

[GitHub] shuizhongxiong edited a comment on issue #7462: 点击事件获得鼠标悬浮数据

shuizhongxiong edited a comment on issue #7462: 点击事件获得鼠标悬浮数据
URL: https://github.com/apache/incubator-echarts/issues/7462#issuecomment-420535077
 
 
   我做了一个折线图与漏斗图联动的逻辑,应该能解决你的问题。
   思路:点击折线图的时候获取到当前 `event` 像素坐标,然后通过 `convertFromPixel` 方法将其转化成数据坐标,然后就能知道相应数据了。
   
   关键代码如下:
   ```js
   // 折线图发射
       myChart.getZr().on('click', (params) => {
           let pointer = myChart.convertFromPixel({ seriesIndex: 0 }, [params.event.zrX, params.event.zrY]);
           let currentIndex = pointer[0];
           if (currentIndex !== undefined) {
               changeFunnel(currentIndex);
           }
       });
   ```
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

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