vue+eChart实现省份地图
import echarts from "echarts";
require("echarts/theme/macarons");
let chart = echarts.init(document.getElementById("shandong-map"));
const shandong = require("@/map/json/province/hunan.json"); // 省份路径
echarts.registerMap("shandong", shandong);
let series = [
{
type: "map", // 设置为地图
map: "hunan", // 核心代码 //设置想要设置的省份
itemStyle: {
normal: { label: { show: true } }, // 显示市文字
emphasis: { label: { show: true } },
},
},
];
let geo = {
map: "hunan", //跟上面一样两个选择其一个进行设置设置想要设置的省份
roam: true,
};
chart.setOption({
series,
geo,
});