配置项如下
var uploadedDataURL = "/asset/get/s/data-1524208379041-rk7-XMw2z.json";
$.get(uploadedDataURL, function (geoJson) {
myChart.hideLoading();
echarts.registerMap('江门市', geoJson);
var allData = {
"citys":[
{"name":"蓬江区 90.60%","value":[113.053,22.673],"symbolSize":14,"itemStyle":{"normal":{"color":"#F58158"}}},
{"name":"江海区 7.69%","value":[113.122,22.543],"symbolSize":6,"itemStyle":{"normal":{"color":"#F58158"}}},
{"name":"新会区(会城街道) 1.71%","value":[112.989,22.452],"symbolSize":1,"itemStyle":{"normal":{"color":"#F58158"}}}
],
"moveLines":[
{"fromName":"蓬江区","toName":"江海区","coords":[[113.053,22.673],[113.122,22.543]]},
{"fromName":"蓬江区","toName":"蓬江区","coords":[[113.053,22.673],[112.989,22.452]]}
]
};
option = {
backgroundColor: '#404a59',
title: {
text: '现居地为蓬江区,有意愿租房比例',
left: 'center',
textStyle: {
color: '#fff'
}
},
legend: {
show: false,
orient: 'vertical',
top: 'auto',
left: 'right',
data: ['地点', '线路'],
textStyle: {
color: '#fff'
}
},
geo: {
map: '江门市',
label: {
//normal:{
//show: true,
//textStyle:{
//color:'#fff',
//}
//},
emphasis: {
show: false,
textStyle:{
color:'#fff',
}
}
},
roam: false,
itemStyle: {
normal: {
areaColor: '#323c48',
borderColor: '#404a59'
},
emphasis: {
areaColor: '#2a333d'
}
}
},
series: [{
name: '地点',
type: 'effectScatter',
coordinateSystem: 'geo',
zlevel: 1,
rippleEffect: {
brushType: 'stroke',
period:7,
scale:26
},
label: {
normal:
{
show : true,
position:'right',
formatter:'{b}'
},
emphasis: {
show: true,
position: 'right',
formatter: '{b}'
}
},
symbolSize: 2,
showEffectOn: 'render',
itemStyle: {
normal: {
color: '#46bee9'
}
},
data: allData.citys
}, {
name: '线路',
type: 'lines',
coordinateSystem: 'geo',
zlevel: 2,
large: true,
effect: {
show: true,
constantSpeed: 50,
symbol: 'arrow',//ECharts 提供的标记类型包括 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'
symbolSize: 10,
trailLength: 0,
},
lineStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0, color: '#58B3CC'
}, {
offset: 1, color: '#F58158'
}], false),
width: 2,
opacity: 0.6,
curveness: 0.2
}
},
data: allData.moveLines
}]
};
myChart.setOption(option);
});