(echarts)数据地图散点类型根据条件设置不同的标记图片
1.用在线工具将本地图片转化base64格式
data(){return { base64Img:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQ...",}
}
在线转换地址:https://www.jyshare.com/front-end/59/
2.symbol属性设置
{name: "散点",type: "scatter",coordinateSystem: "geo",zlevel: 2,// symbol: "pin", //气泡// symbol:'image://http://example.website/a/b.png' //其他写法// symbol: `image://${this.base64Img}`,symbol: (value, params) => {//第一个参数 value 为 data 中的数据值。第二个参数params 是其它的数据项参数//value就是if (params.name == "岳阳" ||params.name == "九江" ||params.name == "台州") {return `image://${this.base64Img}`;} else {return "pin";}},//data格式类似:[{name:'南京',value:['118.767','32.241'],a:'100'}]...
}
解决参考1:https://blog.csdn.net/coconut18061/article/details/131726185
解决参考2:https://blog.csdn.net/weixin_62588253/article/details/136754614