echarts自定义图标的点击事件怎么添加

echarts地图的自定义图标的点击事件,下面是我写的自定义图标,文档上只看到区域的点击事件没看到自定义图标的事件
{

                        seriesName: "交通事件",
                        type: 'custom',//配置显示方式为用户自定义
                        coordinateSystem: 'geo',
                        zlevel: 3,
                        clickable:true,
                        itemStyle: {
                            normal: {
                                color: '#46bee9',
                                position:[10,20]
                            }
                        },
                        renderItem: function (params, api) {//具体实现自定义图标的方法
                            return {
                                type: 'image',//指定渲染类型
                                style: {
                                    image: iconData.icon1,
                                    x: api.coord([
                                        icon[params.dataIndex].value[0], icon[params.dataIndex]//图形在地图上显示的位置
                                            .value[1]
                                    ])[0],
                                    y: api.coord([
                                        icon[params.dataIndex].value[0], icon[params.dataIndex]
                                            .value[1]
                                    ])[1]

                                },
                                position:[-20,-20]//图形偏移
                            }
                        },
                        data: icon,


                    }
阅读 4.1k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题