echars在地图上显示icon图标

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-17 08:11   58   0

整个demo:https://pan.baidu.com/s/1DwiU-j9xoABluXcM5UKxAA

提取码:e4q2

效果如下:

注意要点:

替换为https://geo.datav.aliyun.com/areas_v2/bound/450200_full.json

icon的实现主要代码段:

{
                   name: "运输车分布",
                   type: 'custom',//配置显示方式为用户自定义
                   coordinateSystem: 'geo',
                   itemStyle: {
                       normal: {
                           color: '#46bee9'
                       }
                   },
                   renderItem: function (params, api) {//具体实现自定义图标的方法
                       return {
                           type: 'image',
                           style: {
                               image: "货车.png",
                               x: api.coord([
                                   Car[params.dataIndex].value[0], Car[params.dataIndex]
                                       .value[1]
                               ])[0],
                               y: api.coord([
                                   Car[params.dataIndex].value[0], Car[params.dataIndex]
                                       .value[1]
                               ])[1]
                           }
                       }
                   },
                   data: Car
               }

demo中货车的坐标写死的在 car.js文件中

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP