echarts地图map城市间如何连线
程序员文章站
2022-03-20 16:56:10
let bjData = [ [{name:'北京'}, {name:'上海',value:95}], [{name:'北京'}, {name:'广州',value:90}]]; let convert = (data) => { let res = []; for (var i = 0; i < ......
let bjdata = [
[{name:'北京'}, {name:'上海',value:95}],
[{name:'北京'}, {name:'广州',value:90}]
];
let convert = (data) => {
let res = [];
for (var i = 0; i < data.length; i++) {
var dataitem = data[i];
var from = geocoordmap[dataitem[0].name];
var to = geocoordmap[dataitem[1].name];
if (fromcoord && tocoord) {
res.push({
fromname: dataitem[0].name,
toname: dataitem[1].name,
coords: [from, to]
});
}
}
return res;
};
series: [
{
name: '北京',
type: 'lines',
zlevel: 1,
symbol: ['none'],
symbolsize: 10,
linestyle: {
normal: {
color: '#f00',
width: 1,
opacity: 0.6,
curveness: 0.2
}
},
data: convert(bjdata)
}
]