echarts china.js地图显示不符合国家要求问题
方法一
-
先从下面地址下载中国地图的json文件
-
修改该文件中各省
name,去掉“X族自治区”、“特别行政区”等 -
使用
echarts先注册再使用
//注册
$.getJSON("js/mapJson/china.json", function (data) {
echarts.registerMap('china', data);
})
//使用
geo: {
map: "china",
}
方法二
使用百度地图作为底图
- .vue文件引入bmap.min.js
import "../../../static/js/bmap.min";
- option
let option = {
tooltip: {
//触发类型 数据项图形触发,主要在散点图,饼图等无类目轴的图表中使用。
trigger: "item"
},
//地图配置
bmap: {
center: [121.47, 31.23],
zoom: 6,
roam: true,
mapStyle: {
styleJson: [
{
featureType: "water",
elementType: "all",
stylers: {
color: "#044161"
}
},
{
featureType: "land",
elementType: "all",
stylers: {
color: "#004981"
}
},
{
featureType: "boundary",
elementType: "geometry",
stylers: {
color: "#064f85"
}
},
{
featureType: "railway",
elementType: "all",
stylers: {
visibility: "off"
}
},
{
featureType: "highway",
elementType: "geometry",
stylers: {
color: "#004981"
}
},
{
featureType: "highway",
elementType: "geometry.fill",
stylers: {
color: "#005b96",
lightness: 1
}
},
{
featureType: "highway",
elementType: "labels",
stylers: {
visibility: "off"
}
},
{
featureType: "arterial",
elementType: "geometry",
stylers: {
color: "#004981"
}
},
{
featureType: "arterial",
elementType: "geometry.fill",
stylers: {
color: "#00508b"
}
},
{
featureType: "poi",
elementType: "all",
stylers: {
visibility: "off"
}
},
{
featureType: "green",
elementType: "all",
stylers: {
color: "#056197",
visibility: "off"
}
},
{
featureType: "subway",
elementType: "all",
stylers: {
visibility: "off"
}
},
{
featureType: "manmade",
elementType: "all",
stylers: {
visibility: "off"
}
},
{
featureType: "local",
elementType: "all",
stylers: {
visibility: "off"
}
},
{
featureType: "arterial",
elementType: "labels",
stylers: {
visibility: "off"
}
},
{
featureType: "boundary",
elementType: "geometry.fill",
stylers: {
color: "#029fd4"
}
},
{
featureType: "building",
elementType: "all",
stylers: {
color: "#1a5787"
}
},
{
featureType: "label",
elementType: "all",
stylers: {
visibility: "off"
}
}
]
}
},
series: series
};
//series
coordinateSystem: "bmap",

本文介绍两种解决ECharts中国地图显示不符合国家规定的方法:一是修改地图JSON文件中省份名称,二是使用百度地图底图并调整样式。
5770

被折叠的 条评论
为什么被折叠?



