最近遇到一个新需求,要求展示山东省的地图,并且点击可进入地级市地图。这可是难倒了我,我尝试着用不同的方法,高德地图、百度地图等,发现都有一定的缺陷,最终决定使用echarts实现,下面就来跟大家分享一下我的心路历程。
先来看一下效果:
点击济南市即可进入济南市的地图:
实现步骤如下所示:
1.图中的地图都是需要去网站上自行下载的,包括山东省地图,各个地级市的地图都需要进行下载,网址http://datav.aliyun.com/tools/atlas/,下载格式为.json
2.地图中需要用到的小图标,小图片什么的,需要提前转换成base64格式,百度搜一下,有不少在线转换工具可以直接转换
3.安装echarts,并导入
4.html代码:
<div style="width:400px;height:400px" id="barChart"></div>
5.js代码
//导入地图
import shandong from "../../../../../assets/get/shandongData.json";
......
async getLeftBar() {
let nc = document.getElementById("barChart");
var myChart = this.echarts.init(nc);
this.echarts.registerMap("山东", shandong);
var cityMap = {
济南市: jinan,
青岛市: qingdao,
烟台市: yantai,
潍坊市: weifang,
菏泽市: heze,
日照市: rizhao,
威海市: weihai,
枣庄市: zaozhuang,
临沂市: linyi,
滨州市: bingzhou,
东营市: dongying,
淄博市: zibo,
泰安市: taian,
聊城市: liaocheng,
济宁市: jining,
德州市: dezhou,
};
var sdGeoCoordMap = {
济南市: [117.000923, 36.675807],
青岛市: [120.355173, 36.082982],
烟台市: [121.391382, 37.539297],
潍坊市: [119.107078, 36.70925],
菏泽市: [115.469381, 35.246531],
日照市: [119.461208, 35.428588],
威海市: [122.116394, 37.509691],
枣庄市: [117.557964, 34.856424],
临沂市: [118.326443, 35.065282],
滨州市: [118.016974, 37.383542],
东营市: [118.66471, 37.434564],
淄博市: [118.047648, 36.814939],
泰安市: [117.129063, 36.194968],
聊城市: [115.980367, 36.456013],
济宁市: [116.587245, 35.415393],
德州市: [116.307428, 37.453968],
};
var sdDatas = [
{
name1: "济南市",
name: "济南市供电局",
value: [117.050923, 36.678807, 0.5],
},
{
name1: "济南市",
name: "济南市供电局23",
value: [117.053923, 36.638807, 3.5],
},
{
name1: "济南市",
name: "济南市随便吧",
value: [117.653923, 37.038807, 11],
},
{
name1: "青岛市",
name: "青岛市供电局",
value: [120.385173, 36.042982, 7.5],
},
];
var jinandata = [
{
name: "东莞市供电局",
value: [117.000623, 36.672807, 0.5],
},
{
name: "东莞东城供电分局",
value: [117.001923, 36.685807, 1],
},
{
name: "广东电网东莞南城供电局",
value: [117.002923, 36.675207, 1],
},
{
name: "沙田供电分局",
value: [117.007923, 36.675107, 0.1],
},
{
name: "广东电网(松山湖)",
value: [117.040923, 36.625807, 0.4],
},
{
name: "东莞供电局万江供电局",
value: [117.100923, 36.695807, 1],
},
{
name: "广东电网公司石龙供电分局",
value: [117.003923, 36.673807, 1.4],
},
{
name: "广东电网东莞虎门供电局",
value: [117.002913, 36.676607, 0.7],
},
{
name: "广东电网公司中堂供电公司",
value: [117.01123, 36.633807, 0.1],
},
{
name: "望牛墩供电公司",
value: [117.000333, 36.675557, 0.5],
},
{
name: "东莞供电局石碣供电局",
value: [117.000233, 36.674307, 2],
},
{
name: "高埗供电分局",
value: [117.445923, 36.874507, 0.9],
},
{
name: "东莞市麻涌供电公司",
value: [117.003423, 36.678807, 2],
},
{
name: "东莞市长安供电公司",
value: [117.000444, 36.675444, 2],
},
{
name: "东莞市道滘供电公司",
value: [117.110923, 36.635807, 0.4],
},
{
name: "东莞市洪梅供电公司",
value: [117.0334923, 36.673434, 0.6],
},
{
name: "东莞市厚街供电公司",
value: [117.003423, 36.634807, 2],
},
{
name: "东莞市寮步供电公司",
value: [117.047923, 36.674807, 2],
},
{
name: "大岭山供电公司",
value: [117.046923, 36.635807, 0.1],
},
{
name: "广东电网大朗供电分公司",
value: [117.150923, 36.715807, 0.9],
},
{
name: "黄江供电分局",
value: [117.003453, 36.672307, 0.5],
},
{
name: "东莞供电局樟木头供电局",
value: [117.099923, 36.699807, 2],
},
{
name: "东莞市清溪供电公司",
value: [117.089923, 36.689807, 2],
},
{
name: "东莞供电局谢岗分局",
value: [117.029923, 36.629807, 2],
},
{
name: "东莞市凤岗镇雁田供电所",
value: [117.004443, 36.673337, 0.4],
},
{
name: "东莞常平供电分局",
value: [117.004373, 36.6787857, 0.6],
},
{
name: "东莞桥头供电分局",
value: [117.003413, 36.623407, 2],
},
{
name: "东莞电网横沥供电分局",
value: [117.00032343, 36.6342807, 0.8],
},
{
name: "广东电网公司东莞东坑供电分局",
value: [117.0087653, 36.67467807, 0.2],
},
{
name: "塘厦供电局",
value: [117.045673, 36.6567307, 2],
},
{
name: "企石供电局",
value: [117.003633, 36.6755427, 0.7],
},
{
name: "石排供电公司",
value: [117.0456923, 36.645807, 0.1],
},
{
name: "茶山供电分局",
value: [117.003453, 36.6345807, 0.2],
},
];
var qingdaodata = [
{
name: "东莞市供电局",
value: [120.345173, 36.0842982, 0.5],
},
];
var yantaidata = [
{
name: "东莞市供电局",
value: [121.393382, 37.53497, 0.5],
},
];
var weifangdata = [
{
name: "东莞市供电局",
value: [119.107078, 36.70925, 0.5],
},
];
var hezedata = [
{
name: "东莞市供电局",
value: [115.489381, 35.286531, 0.5],
},
];
var rizhaodata = [
{
name: "东莞市供电局",
value: [119.491208, 35.499588, 0.5],
},
];
var weihaidata = [
{
name: "东莞市供电局",
value: [122.1199394, 37.599691, 0.5],
},
];
var zaozhuangdata = [
{
name: "东莞市供电局",
value: [117.597964, 34.896424, 0.5],
},
];
var linyidata = [
{
name: "东莞市供电局",
value: [118.386443, 35.085282, 0.5],
},
];
var bingzhoudata = [
{
name: "东莞市供电局",
value: [118.016974, 37.383542, 0.5],
},
];
var dongyingdata = [
{
name: "东莞市供电局",
value: [118.016974, 37.383542, 0.5],
},
];
var zibodata = [
{
name: "东莞市供电局",
value: [118.016974, 37.383542, 0.5],
},
];
var taiandata = [
{
name: "东莞市供电局",
value: [118.016974, 37.383542, 0.5],
},
];
var liaochengdata = [
{
name: "东莞市供电局",
value: [118.016974, 37.383542, 0.5],
},
];
var jiningdata = [
{
name: "东莞市供电局",
value: [118.016974, 37.383542, 0.5],
},
];
var dezhoudata = [
{
name: "东莞市供电局",
value: [118.016974, 37.383542, 0.5],
},
];
var that = this;
var opt = {
bgColor: "#013954", // 画布背景色
mapName: "山东", // 地图名
goDown: true, // 是否下钻
// 下钻回调
callback: async function (name, option, instance) {
console.log(name, option, instance);
if (name == "山东") {
this.ifShow = true;
option.series[0].data = converntData(data_tmp);
option.series[1].data = data_tmp;
myChart.setOption(option, true);
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
} else if (name == "济南市") {
that.ifShow = false;
that.cityName = "济南市";
that.cityCode = "370100";
await that.getLonLat();
that.getSixData();
that.$emit("changeArea", "济南市", "370100");
setTimeout(() => {
option.series[0] = {
type: "effectScatter",
coordinateSystem: "geo",
zlevel: 2,
rippleEffect: {
//涟漪特效
period: 8, //动画时间,值越小速度越快
brushType: "fill", //波纹绘制方式 stroke, fill
scale: 0, //波纹圆环最大限制,值越大波纹越大
},
label: {
normal: {
show: false,
position: "right", //显示位置
offset: [5, 0], //偏移设置
formatter: function (params) {
//圆环显示文字
return params.data.name;
},
fontSize: 19,
},
emphasis: {
show: true,
},
},
itemStyle: {
normal: {
show: false,
color: "#f00",
},
},
data: that.dataArr,
};
}, 600);
option.series[1].data = that.cityFactoryData;
option.series[2].data = that.cityFactoryData;
console.log("option.series:");
console.log(option.series);
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 600);
} else if (name == "青岛市") {
that.ifShow = false;
that.cityName = "青岛市";
that.cityCode = "370200";
await that.getLonLat();
that.getSixData();
that.$emit("changeArea", "青岛市", "370200");
setTimeout(() => {
option.series[0] = {
type: "effectScatter",
coordinateSystem: "geo",
zlevel: 2,
rippleEffect: {
//涟漪特效
period: 8, //动画时间,值越小速度越快
brushType: "fill", //波纹绘制方式 stroke, fill
scale: 0, //波纹圆环最大限制,值越大波纹越大
},
label: {
normal: {
show: false,
position: "right", //显示位置
offset: [5, 0], //偏移设置
formatter: function (params) {
//圆环显示文字
return params.data.name;
},
fontSize: 19,
},
emphasis: {
show: true,
},
},
itemStyle: {
normal: {
show: false,
color: "#f00",
},
},
data: that.dataArr,
};
}, 600);
option.series[1].data = that.cityFactoryData;
option.series[2].data = that.cityFactoryData;
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 600);
} else if (name == "烟台市") {
that.ifShow = false;
that.cityName = "烟台市";
that.cityCode = "370600";
that.getLonLat();
that.getSixData();
that.$emit("changeArea", "烟台市", "370600");
option.series[0].data = convertData1(yantaidata);
option.series[1].data = yantaidata;
option.series[2].data = [];
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
} else if (name == "潍坊市") {
that.ifShow = false;
that.cityName = "潍坊市";
that.cityCode = "370700";
that.getLonLat();
that.getSixData();
that.$emit("changeArea", "潍坊市", "370700");
option.series[0].data = convertData1(weifangdata);
option.series[1].data = weifangdata;
option.series[2].data = [];
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
} else if (name == "菏泽市") {
that.ifShow = false;
that.cityName = "菏泽市";
that.cityCode = "371700";
that.getLonLat();
that.getSixData();
that.$emit("changeArea", "菏泽市", "371700");
option.series[0].data = convertData1(hezedata);
option.series[1].data = hezedata;
option.series[2].data = [];
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
} else if (name == "日照市") {
that.ifShow = false;
that.cityName = "日照市";
that.cityCode = "371100";
that.getLonLat();
that.getSixData();
that.$emit("changeArea", "日照市", "371100");
option.series[0].data = convertData1(rizhaodata);
option.series[1].data = rizhaodata;
option.series[2].data = [];
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
} else if (name == "威海市") {
that.ifShow = false;
that.cityName = "威海市";
that.cityCode = "371000";
that.getLonLat();
that.getSixData();
that.$emit("changeArea", "威海市", "371000");
option.series[0].data = convertData1(weihaidata);
option.series[1].data = weihaidata;
option.series[2].data = [];
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
} else if (name == "枣庄市") {
that.ifShow = false;
that.cityName = "枣庄市";
that.cityCode = "370400";
that.getLonLat();
that.getSixData();
that.$emit("changeArea", "枣庄市", "370400");
option.series[0].data = convertData1(zaozhuangdata);
option.series[1].data = zaozhuangdata;
option.series[2].data = [];
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
} else if (name == "临沂市") {
that.ifShow = false;
that.cityName = "临沂市";
that.cityCode = "371300";
that.getLonLat();
that.getSixData();
that.$emit("changeArea", "临沂市", "371300");
option.series[0].data = convertData1(linyidata);
option.series[1].data = linyidata;
option.series[2].data = [];
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
} else if (name == "滨州市") {
that.ifShow = false;
that.cityName = "滨州市";
that.cityCode = "371600";
that.getLonLat();
that.getSixData();
that.$emit("changeArea", "滨州市", "371600");
option.series[0].data = convertData1(bingzhoudata);
option.series[1].data = bingzhoudata;
option.series[2].data = [];
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
} else if (name == "东营市") {
that.ifShow = false;
that.cityName = "东营市";
that.cityCode = "370500";
that.getLonLat();
that.getSixData();
that.$emit("changeArea", "东营市", "370500");
option.series[0].data = convertData1(dongyingdata);
option.series[1].data = dongyingdata;
option.series[2].data = [];
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
} else if (name == "淄博市") {
that.ifShow = false;
that.cityName = "淄博市";
that.cityCode = "370300";
that.getLonLat();
that.getSixData();
that.$emit("changeArea", "淄博市", "370300");
option.series[0].data = convertData1(zibodata);
option.series[1].data = zibodata;
option.series[2].data = [];
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
} else if (name == "泰安市") {
that.ifShow = false;
that.cityName = "泰安市";
that.cityCode = "370900";
that.getLonLat();
that.getSixData();
that.$emit("changeArea", "泰安市", "370900");
option.series[0].data = convertData1(taiandata);
option.series[1].data = taiandata;
option.series[2].data = [];
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
} else if (name == "聊城市") {
that.ifShow = false;
that.cityName = "聊城市";
that.cityCode = "371500";
that.getLonLat();
that.getSixData();
that.$emit("changeArea", "聊城市", "371500");
option.series[0].data = convertData1(liaochengdata);
option.series[1].data = liaochengdata;
option.series[2].data = [];
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
} else if (name == "济宁市") {
that.ifShow = false;
that.cityName = "济宁市";
that.cityCode = "370800";
that.getLonLat();
that.getSixData();
that.$emit("changeArea", "济宁市", "370800");
option.series[0].data = convertData1(jiningdata);
option.series[1].data = jiningdata;
option.series[2].data = [];
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
} else if (name == "德州市") {
that.ifShow = false;
that.cityName = "德州市";
that.cityCode = "371400";
that.getLonLat();
that.getSixData();
that.$emit("changeArea", "德州市", "371400");
option.series[0].data = convertData1(dezhoudata);
option.series[1].data = dezhoudata;
option.series[2].data = [];
myChart.setOption(option, true); // 赋值后初始化
setTimeout(() => {
// 定时后启动飞线
myChart.setOption(option, true);
}, 500);
}
},
// 数据展示
data: [],
};
var defaultOpt = {
mapName: "china", // 地图展示
goDown: true, // 是否下钻
bgColor: "#013954", // 画布背景色
activeArea: [], // 区域高亮,同echarts配置项
data: [],
// 下钻回调(点击的地图名、实例对象option、实例对象)
callback: function () {},
// callback: function (name, option, instance) {},
};
var opt1 = "";
if (opt) {
opt1 = $.extend(defaultOpt, opt);
}
// 层级索引
var name = [opt1.mapName];
var idx = 0;
var pos = {
//层级位置
leftPlus: 55,
leftCur: 50,
left: 10,
top: 10,
};
var line = [
//箭头
[0, 0],
[8, 11],
[0, 22],
];
// 头部导航style样式
var style = {
font: '18px "Microsoft YaHei", sans-serif',
textColor: "#eee",
lineColor: "rgba(147, 235, 248, .8)",
};
var handleEvents = {
/**
* i 实例对象
* o option
* n 地图名
**/
resetOption: function (i, o, n) {
console.log(i);
console.log(o);
console.log(n);
var breadcrumb = this.createBreadcrumb(n);
var j = name.indexOf(n);
var l = o.graphic.length;
if (j < 0) {
console.log("jinru1");
o.graphic.push(breadcrumb);
o.series = series;
o.graphic[0].children[0].shape.x2 = 195;
o.graphic[0].children[1].shape.x2 = 195;
if (o.graphic.length > 2) {
for (var x = 0; x < opt1.data.length; x++) {
if (n === opt1.data[x].name + "市") {
o.series[0].data = handleEvents.initSeriesData(
opt1.data[x].data
);
break;
} else o.series[0].data = [];
}
}
name.push(n);
idx++;
} else {
console.log("jinru2", j);
o.graphic.splice(j + 2, l);
if (o.graphic.length <= 2) {
o.graphic[0].children[0].shape.x2 = 85;
o.graphic[0].children[1].shape.x2 = 85;
o.series[0].data = handleEvents.initSeriesData(data_tmp);
o.series[0].symbol = zuanshi;
o.series[0].symbolSize = 30;
o.series[2].data = handleEvents.initSeriesData(data_tmp);
}
name.splice(j + 1, l);
idx = j;
pos.leftCur -= pos.leftPlus * (l - j - 1);
}
o.geo.map = n;
o.geo.zoom = 1;
i.clear();
i.setOption(o);
this.zoomAnimation();
opt1.callback(n, o, i);
},
createBreadcrumb: function (name) {
var cityToPinyin = {
济南市: "jinan",
青岛市: "qingdao",
烟台市: "yantai",
潍坊市: "weifang",
菏泽市: "heze",
日照市: "rizhao",
威海市: "weihai",
枣庄市: "zaozhuang",
临沂市: "linyi",
滨州市: "bingzhou",
东营市: "dongying",
淄博市: "zibo",
泰安市: "taian",
聊城市: "liaocheng",
济宁市: "jining",
德州市: "dezhou",
};
var breadcrumb = {
type: "group",
id: name,
left: pos.leftCur + pos.leftPlus,
top: pos.top + 3,
children: [
{
type: "polyline",
left: -90,
top: -5,
shape: {
points: line,
},
style: {
stroke: "#fff",
key: name,
},
onclick: function () {
var name = this.style.key;
handleEvents.resetOption(myChart, option, name);
},
},
{
type: "text",
left: -68,
top: "middle",
style: {
text: name,
textAlign: "center",
fill: style.textColor,
font: style.font,
},
onclick: function () {
var name = this.style.text;
handleEvents.resetOption(myChart, option, name);
},
},
{
type: "text",
left: -68,
top: 10,
style: {
name: name,
text: cityToPinyin[name]
? cityToPinyin[name].toUpperCase()
: "",
textAlign: "center",
fill: style.textColor,
font: '12px "Microsoft YaHei", sans-serif',
},
onclick: function () {
// console.log(this.style);
var name = this.style.name;
handleEvents.resetOption(myChart, option, name);
},
},
],
};
pos.leftCur += pos.leftPlus;
return breadcrumb;
},
// 设置effectscatter
initSeriesData: function (data) {
console.log(data, "22222222222");
var temp = [];
for (var i = 0; i < data.length; i++) {
var geoCoord = sdGeoCoordMap[data[i].name];
if (geoCoord) {
temp.push({
name: data[i].name,
value: geoCoord.concat(data[i].value, data[i].level),
});
}
}
return temp;
},
zoomAnimation: function () {
var count = null;
var zoom = function (per) {
if (!count) count = per;
count = count + per;
// console.log(per,count);
myChart.setOption({
geo: {
zoom: count,
},
});
if (count < 1)
window.requestAnimationFrame(function () {
zoom(0.2);
});
};
window.requestAnimationFrame(function () {
zoom(0.2);
});
},
};
var iconYellow =
"image://data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAdCAYAAAC5UQwxAAAAAXNSR0IArs4c6QAAA/tJREFUSEu9lm9olWUYxn/Xc3a21Wzm3I7NxFaUWFpJCfVFyKQIRiHI+kOOnRlIoEJ9ibAP+cGIIqgP0R8ozsnsD1gIfTAIEjMMoiiKSimliWl1dubENWfb3ueKczbNuc1zbND78X2v5/nd93Nfz/3eosrHxc7rIXVfjCwLgSZbpwW/YO+m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axxfOtk40ak3F1fqblupVl/bvPiFa2YGf1vJkua5njWQ0nB1cGDD0MbS2NB4ebg2kQ5XJyRJSsUjvAo8Bswss8wScBj4l//M9xeDsAPYiYvbs8kHgG8ANTPT9uypd5rTJ95tTp+YoqPZuZRYTurlbHS4nc73M5dSkla3bLykumXj+8qbRi4TkQSXK34E/HuF2fPAy8AhcCAMAJ/FufxyMgjsAUbaJxuT82+8+0JWby70tfkLIOlwdWjDR95/fWl06FKcgrtxCXQlmQT2J7j4OhcAANcBI+2T9cnZFw4+/f8EAEBWbzaOP3/wqfbJxiTOk69d5dRtwE0JLquvJEcB0lp1U2V8ZGNfO73AUhkf3ZTWKpv81+XywtnkfQmu3KwkbwIvJ+VSbcN1V3xu9KOX7UxrlcFeN3ohJK1VaqPXXr5zw3UfvCUpl2q4WH+rhyXeW21OACgDXwZuxP8MpdNoHVuanT+8dOzk1NJcfQ5dA21brSQiA2PDYwObN1wyMD66rTRUmUAkcO1ngUeB9ipXmwT291IdglwJfB64ioh2m1onW2jNZgvNuWyxNd9pNE916s26Npea2mq3Vq+lk6RSriSDA9XyUHU4HaqOpIOV0bRWHUtrlU2SSMxvFDgA/A5X/lYjZ1SHeHAlnhDLMI4sXYsjMEPLPmlm2slaqLYssw6AqbbDPxEkScoAkkqJJKkkpbTirbucNHAKvwq8gmOMK8mqeMLpEhjjdooeYLmGS/z4VuBiHKna6K9hHEDlVWw0SBunaB1Hf0/gkt0UjgEeZwUyhvOQwBgPcw7GeC7arMB//QXL9w7DfmzGX8uhWvHPpjjeUcJ52hLQwdX1DKd4L+FzQXuHs70svCCWuIscwXWRVZyiFX+V/btO4EAoc3avUpwXZDhgOv57y1+LuE5yAaf0KZzHrCkh/w96n2tEAXE6lAAAAABJRU5ErkJggg==";
var convertData = function (data) {
data.forEach((item) => {
item.symbol =
item.value[2] < 1
? iconYellow
: item.value[2] < 6 && item.value[2] >= 1
? iconGreen
: iconBlue;
item.symbolSize = 20;
});
return data;
};
var convertData1 = function (data) {
data.forEach((item) => {
item.symbol = iconYellow;
item.symbolSize = 20;
});
return data;
};
var symbolFunc = function (data) {
var iconColor;
data.forEach((item) => {
iconColor =
item.coalAvaDay < 7
? iconRed
: item.coalAvaDay > 14
? iconGreen
: iconYellow;
});
return iconColor;
};
var data_tmp = [
{ name: "济南市", value: 24 },
{ name: "青岛市", value: 48 },
{ name: "烟台市", value: 48 },
{ name: "潍坊市", value: 61 },
{ name: "菏泽市", value: 22 },
{ name: "日照市", value: 18 },
{ name: "威海市", value: 35 },
{ name: "枣庄市", value: 20 },
{ name: "临沂市", value: 52 },
{ name: "滨州市", value: 88 },
{ name: "东营市", value: 30 },
{ name: "淄博市", value: 30 },
{ name: "泰安市", value: 36 },
{ name: "聊城市", value: 46 },
{ name: "济宁市", value: 56 },
{ name: "德州市", value: 28 },
];
var converntData = function (data) {
var res = [];
for (var i = 0; i < data.length; i++) {
var geoCoord = sdGeoCoordMap[data[i].name];
if (geoCoord) {
res.push({
name: data[i].name,
value: geoCoord.concat(data[i].value),
});
}
}
return res;
};
var series = [];
[["济南市", data_tmp]].forEach(function (item, i) {
series.push(
// 下面圆点
{
symbol: zuanshi,
symbolSize: 30,
label: {
normal: {
formatter: "{b}",
position: "right",
show: false, //是否显示地名
},
emphasis: {
show: true,
},
},
itemStyle: {
normal: {
color: "#fff",
},
},
name: "light",
type: "scatter",
coordinateSystem: "geo",
data: converntData(
data_tmp
.sort(function (a, b) {
return b.value - a.value;
})
.slice(0, 20)
),
showEffectOn: "render",
rippleEffect: {
brushType: "stroke",
},
hoverAnimation: true,
},
{
type: "map",
map: "china",
geoIndex: 0,
aspectScale: 0.75, //长宽比
showLegendSymbol: false, // 存在legend时显示
label: {
normal: {
show: false,
},
emphasis: {
show: false,
textStyle: {
color: "#fff",
},
},
},
roam: true,
itemStyle: {
normal: {
areaColor: "#031525",
borderColor: "#FFFFFF",
},
emphasis: {
areaColor: "#2B91B7",
},
},
animation: false,
data: data_tmp,
},
// 黄圈圈
{
name: "Top 5",
type: "scatter",
coordinateSystem: "geo",
symbol: mapTextBack,
symbolSize: [70, 30],
symbolOffset: [0, -33],
label: {
normal: {
show: true,
textStyle: {
fontSize: 12,
fontFamily: "Adobe Heiti Std",
fontWeight: "bold",
color: "#FFFFFF",
},
formatter(value) {
if (value.length > 2) {
return "值是:" + value.data.value[2];
} else {
return value.data.name;
}
},
},
},
itemStyle: {
normal: {
color: "#dfae10", //标志颜色
},
},
data: converntData(
data_tmp
.sort(function (a, b) {
return b.value - a.value;
})
.slice(0, 20)
), // 流量最大的前
showEffectOn: "render",
rippleEffect: {
brushType: "stroke",
},
hoverAnimation: true,
zlevel: 1,
}
);
});
console.log("series");
console.log(series);
var that = this;
var option = {
tooltip: {
trigger: "item",
backgroundColor: "rgba(0,0,0,0)",
formatter: function (item) {
console.log(item, "item!!!!");
if (item.componentSubType === "lines") {
var tipHtml1 = "";
tipHtml1 =
'<div style="background:#fff;border-radius:10px;padding-top:10px;box-shadow:0 0 10px #666">' +
'<div style="color:#fff;height:20px;border-radius:6px;font-size:12px;line-height:20px;background-color:#5861a2;text-align:center;margin:0 2px;">' +
item.data.name +
"</div>" +
'<div style="text-align:center;color:#494949;padding:8px 6px">' +
'<span style="font-size:18px;font-weight:bold;">' +
"在运机组数:" +
item.data.value +
" " +
"</span>" +
"</div>" +
"</div>";
return tipHtml1;
} else if (item.componentSubType === "effectScatter") {
var tipHtml2 = "";
tipHtml2 =
'<div style="background:#fff;border-radius:10px;padding-top:10px;box-shadow:0 0 10px #666">' +
'<div style="color:#fff;height:20px;border-radius:6px;font-size:12px;line-height:20px;background-color:#5861a2;text-align:center;margin:0 2px;">' +
item.data.name +
"</div>" +
'<div style="text-align:center;color:#494949;padding:8px 6px">' +
'<span style="font-size:18px;font-weight:bold;">' +
"在运机组数:" +
item.data.value[2] +
" " +
"</span>" +
"</div>" +
"</div>";
return tipHtml2;
} else if (item.componentSubType === "scatter") {
var tipHtml3 = "";
tipHtml3 =
'<div style="background:#fff;border-radius:10px;padding-top:10px;box-shadow:0 0 10px #666">' +
'<div style="color:#fff;height:20px;border-radius:6px;font-size:12px;line-height:20px;background-color:#5861a2;text-align:center;margin:0 2px;">' +
item.data.name +
"</div>" +
'<div style="text-align:center;color:#494949;padding:8px 6px">' +
'<span style="font-size:18px;font-weight:bold;">' +
"在运机组数:" +
item.data.value[2] +
" " +
"</span>" +
"</div>" +
"</div>";
return tipHtml3;
}
},
},
backgroundColor: "rgb(0,0,0,0)", //背景色透明
graphic: [
{
type: "group",
left: pos.left,
top: pos.top - 4,
children: [
{
type: "line",
left: 0,
top: -20,
shape: {
x1: 0,
y1: 0,
x2: 85,
y2: 0,
},
style: {
stroke: style.lineColor,
},
},
{
type: "line",
left: 0,
top: 20,
shape: {
x1: 0,
y1: 0,
x2: 85,
y2: 0,
},
style: {
stroke: style.lineColor,
},
},
],
},
{
id: name[idx],
type: "group",
left: pos.left + 2,
top: pos.top,
children: [
{
type: "polyline",
left: 90,
top: -12,
shape: {
points: line,
},
style: {
stroke: "transparent",
key: name[0],
},
onclick: function () {
var name = this.style.key;
handleEvents.resetOption(myChart, option, name);
},
},
{
type: "text",
left: 0,
top: "middle",
style: {
text: name[0] === "山东" ? "山东省" : name[0],
textAlign: "center",
fill: style.textColor,
font: style.font,
},
onclick: function () {
that.ifShow = true;
that.$emit("changeArea", "山东省");
handleEvents.resetOption(myChart, option, "山东");
},
},
{
type: "text",
left: 0,
top: 10,
style: {
text: "SHANDONG",
textAlign: "center",
fill: style.textColor,
font: '12px "Microsoft YaHei", sans-serif',
},
onclick: function () {
that.ifShow = true;
that.$emit("changeArea", "山东省");
handleEvents.resetOption(myChart, option, "山东");
},
},
],
},
],
// 暂时先注释
// visualMap: {
// //图例值控制
// min: 0,
// max: 1,
// calculable: true,
// show: false,
// color: ["#f44336", "#fc9700", "#ffde00", "#ffde00", "#00eaff"],
// textStyle: {
// color: "#fff",
// },
// },
geo: {
map: "山东",
layoutCenter: ["55%", "50%"],
layoutSize: "135%",
label: {
normal: {
show: true,
textStyle: {
color: "#fff",
},
},
emphasis: {
textStyle: {
color: "#fff",
},
},
},
roam: true, //是否允许缩放
mapLocation: {
width: "110%",
height: "97%",
},
itemStyle: {
normal: {
borderColor: "rgba(147, 235, 248, 1)",
borderWidth: 1,
areaColor: {
type: "radial",
x: 0.5,
y: 0.5,
r: 0.8,
colorStops: [
{
offset: 0,
color: "rgba(147, 235, 248, 0)", // 0% 处的颜色
},
{
offset: 1,
color: "rgba(147, 235, 248, .2)", // 100% 处的颜色
},
],
globalCoord: false, // 缺省为 false
},
shadowColor: "rgba(128, 217, 248, 1)",
// shadowColor: 'rgba(255, 255, 255, 1)',
shadowOffsetX: -2,
shadowOffsetY: 2,
shadowBlur: 10,
},
emphasis: {
itemStyle: {
areaColor: "#FFD181",
borderColor: "#404a59",
borderWidth: 1,
},
},
},
},
series: series,
};
myChart.setOption(option);
myChart.on("click", function (params) {
var _self = this;
if (cityMap[params.name]) {
var url = cityMap[params.name];
echarts.registerMap(params.name, url);
handleEvents.resetOption(_self, option, params.name);
}
});
},
代码量比较多,里面有一些冗余代码,大家可以自行选择是否删除
另外,我贴出的代码只包含地图部分,截图中的图例之类的,这里不做解释,欢迎大家留言讨论!