1 回答
TA贡献2039条经验 获得超7个赞
你需要三个东西
中国地图,可以去官方下载
需要城市坐标
城市数据
随便给你点你看看
import echarts from 'echarts'
import chinaJson from '../assets/china.json'
const geoCoordMap = {
"海门": [121.15, 31.89],
"鄂尔多斯": [109.781327, 39.608266]
}
const option = {
series: [
{
name: '薪资',
type: 'scatter',
coordinateSystem: 'geo',
data: convertData([
{ name: "天津", value: "6470" },
{ name: "广州", value: "8890" },
{ name: "深圳", value: "10810" },
{ name: "北京", value: "15030" },
{ name: "上海", value: "13440" },
{ name: "南京", value: "7880" },
}]
}
之后配置一下地图
const myChart = echarts.init(document.getElementById('main'))
echarts.registerMap('china', chinaJson);
myChart.setOption(option)
添加回答
举报