地图 scatter 自定义图片

const highLight = require("");

type: "scatter",
      roam: false,
      symbol: "image://" + highLight,
      symbolSize: 22,
      coordinateSystem: "geo",
      data: convertData(data),
      label: {
        emphasis: {
          show: false
        }
      },

function convertData(data) {
  let res = [];
  for (let i = 0; i < data.length; i++) {
    let geoCoord = geoCoordMap[data[i].name];
    if (geoCoord) {
      res.push({
        ...data[i], // 其他参数
        name: data[i].name,
        value: geoCoord.concat(data[i].value),
      });
    }
  }
  return res;
}

  

图片需要require导入,当作变量使用。

posted @ 2020-12-17 17:49  玛卡巴鉲  阅读(425)  评论(0编辑  收藏  举报