<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>朔州地图</title>
<script src="./static/echarts.min.js"></script>
</head>
<body>
<div id="map" style="width: 800px; height: 500px;"></div>
<script>
// 原生 fetch 加载 JSON(无需额外库)
fetch('./json/shuozhou.json')
.then(response => response.json())
.then(shuoZhouMapData => {
echarts.registerMap('朔州', shuoZhouMapData); // 注册地图
const chart = echarts.init(document.getElementById('map'));
chart.setOption({
visualMap: {max: 10000, min: 10, text: ['高', '低'] , calculable: true},
title: {text: '朔州市用户分布',left: 'left'},
series: [{
type: 'map',
map: '朔州',
label: {show: true},
data: [
{ name: '朔城区', value: 1000 },
{ name: '平鲁区', value: 7880 },
{ name: '山阴县', value: 9968 },
{ name: '应县', value: 4005 },
{ name: '右玉县', value: 30 },
{ name: '怀仁市', value: 530 }
]
}]
});
})
</script>
</body>
</html>
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。