在全国地图上,加载了京津冀告诉的geojson数据。显示出来了,但是不能随着地图的放大缩小
配置项如下
var busLines = [];
var uploadedDataURL = "/asset/get/s/data-1607071153577-OIgGAOb1v.json";
$.getJSON(uploadedDataURL, function(da) {
//为了转换LineString
var map = {};
busLines = [].concat(da.features.map(function(feature, idx) {
var coords = feature.geometry.coordinates;
return {
coords: coords,
}
}));
console.log(busLines)
var option = {
geo: {
map: 'china',
label: {
emphasis: {
show: false
}
},
roam: true,
itemStyle: {
normal: {
areaColor: 'white',
borderColor: '#404a59'
},
// emphasis: {
// areaColor: ''
// }
}
},
title: [{
textStyle: {
color: "#000",
fontSize: 18
},
subtext: "",
text: "河北",
top: "auto",
subtextStyle: {
color: "#aaa",
fontSize: 12
},
left: "auto"
}],
backgroundColor: "#fff",
series: [{
type: 'lines',
coordinateSystem: 'geo',
zlevel: 2,
// polyline: true,
data: busLines,
lineStyle: {
normal: {
color: 'green',
opacity: 1,
width: 1
}
},
polyline: true,
}],
//polyline: true,
};
myChart.setOption(option);
})