howiekang opened a new issue, #18132:
URL: https://github.com/apache/echarts/issues/18132

   ### What problem does this feature solve?
   
   我想要在EChart中实现地图任意选点(不是EChart已经在地图上绘制好的地点,而是随便点击地图某一处),能获取到点击处的左边。该怎么办???
   
   vue版本:^3.2.33
   地图:百度地图
   EChart版本:^5.4.1
   
   目前已经尝试的办法:
   1 通过下边这段代码
     ```
   echarts.registerTheme('theme', EChartsTheme.theme);
     const myChart = echarts.init(document.getElementById('projectMap')!, 
'theme');
     //尝试获取地图实例
     const map = myChart.getModel().getComponent('bmap').getBMap();
   ```
    我参考了EChart中百度地图的官方扩展,但是`myChart.getModel().getComponent('bmap').getBMap()` 
这段代码报错了。具体的错误是 `Uncaught (in promise) TypeError: Cannot read properties of 
undefined (reading 'getComponent')`
   2 
   ```
   echarts.registerTheme('theme', EChartsTheme.theme);
     const myChart = echarts.init(document.getElementById('projectMap')!, 
'theme');
     const bmap = echarts.getMap('bmap');
     //这里报错了,addEventListener 不存在
     bmap.addEventListener('click', function (e) {
       alert('click!');
     });
   ```
   3 通过打印当前的window对象,尝试寻找相关的地图实例。
   
   以上办法都没有成功。
   
   我目前的思路有两个:
   1 获取到EChart中地图的实例,然后就可以随便操作了。
   2 通过EChart中的事情,直接控制点击。
   
   ### What does the proposed API look like?
   
   直接获取到BMap对象


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to