1、echarts地图打点加鼠标移上去显示文字
if (res.code == 0) {
const resData = res.data || [];
if (resData.length > 0) {
for (var i = 0; i < resData.length; i++) {
let arr = new Array(2);
arr[0] = resData[i].longitude || "";
arr[1] = resData[i].dimension || "";
arr[2] = 2;
this.pointData.push({
name: resData[i].enName,
codeNum: resData[i].codeNum,
enName: resData[i].enName,
accessNum: resData[i].accessNum,
cityName: resData[i].cityName,
cityCode: resData[i].cityCode,
value: arr,
id: i,
});
}
}
this.mapOption = getMapRayOption(this.pointData);
this.mapOption.series[2] = {
type: "scatter3D",
coordinateSystem: "geo3D",
symbol: "pin",
symbolSize: 25,
itemStyle: {
color: "#c9ae1d",
},
label: {
show: false,
},
emphasis: {
label: {
show: true,
distance: 5,
position: "top",
formatter(params) {
return (
"\n" + params.data.enName + ":" + params.data.codeNum + "\n"
);
},
textStyle: {
color: "#fff",
fontSize: 12,
padding: [-3, 10],
borderWidth: 1,
backgroundColor: "#051d1f",
},
},
},
data: this.pointData,
};
}
this.$refs.mymap.registerMap(this.areaCode);