Echarts-地图扩展-标准geoJson格式扩展地图-例子

本人菜鸟一枚,最近搞echarts地图。看到官方给的“标准geoJson格式扩展地图-全国主要城市”的例子,瞬间就蒙逼了。不怪人官网的例子不好,实在是我看不懂它是怎么弄得。最后折腾了一晚上,最后终于弄出个想样子的例子来。(有同感的收藏下,高手勿喷!)

下面这个例子是我弄得汕尾市的,里面的链接是我项目的,我就不改了。这段代码其实是两个例子凑起来的,大家也可以再自己的项目里面试试。中间绿色部分是抄的官方的“标准geoJson格式扩展地图-全国主要城市”code。其他代码抄的是Echarts的start第4步的例子。大家改成自己的项目路径就ok了。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOwAAAG/CAIAAADU3KyuAAAdGUlEQVR4nO2dbYwVVZrH20+TkOWDjg0JCR80JDu6bBYXHNu7I91hMmaZ9Pqywa+umZibcXfI4PpyxwEhg4LIi15kwPUt3eCCiu0bo9dhEcks2E50ZBxt/OB1BBlXBunWtsHu+0af/VDdt07VOVXn1D11q+qp+v9SId11z6mqS//69Ll1z/8+HQwkhs2bN8d49hf+88LX1vzt2OmPfdrEe4VedMR9AcAmmYrwJPMKITEgDyQG5IHEgBijApAYEAMSA/JAYkAeSAzIE4PE4yN/eWf7zUc2Xndk43XvbL95fOQv7T4jSDemEk9OTir3uPjdxusnhsvnJ86cnzjzzcn33v71zcEuGQAnRhL39fUVCoV6vd7cU6/XC4VCf3+/V5fx4eOH1131xVsrv/5g/dkP7h/9w5ov3rjrT0/c9O623ne39b7f92/Vc8NGTwhkj9YlbjQahUKhp6en6bFlsLWn0WhIew1uufav7z8x+ue9Y8cHxo4PjH36/Gh579fl5745/vI3x18e/ujpd7b/q/c5y8VcR75Uynd0dOSKZcYYK+U7ppjaYTWaIl+a6mg3s3daB3N/rXMKzZOCiHAZfMsttwQYiWu1WtPa8fFxl9NSDqxeWDld8tkOrF7ofUJLFV5Nh0X5klNNu5ndjpXyU0fwlthlv903wElBdLgMDiYx40bf3t5epcGMsddXXlH5/Hlr+/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SYc8yapN85FYN4oif6bOZyM+FwmQOBiPrOziX9V97yc7tDJ2uuEH2Y+WTxvZP10fie09rdQU9Y8QKQJGoUus9VwgcTAeKlxtjcHNTW89sTSvxu+0Ss0pcp1c/M5bYkmFPCfcAnrnpwYIcdHmqXUfNZO4eRxuOqF4LsKZGCRWsuHuf+INtkZirUXx0lco9k5FxcWp2UA+7zESTzea1t7/tZDHC0XH70pLj4YtscZzYZA4KOvu+IGl78kzE8EkBvqY3buDxAp+dfsPPv3rBL9B4tAxe9cZEqtYs+KaVT9fvGrF4lUrFq9csXjVisWQOExKIVT7g8TBQcYuYUBiQB5IDMgDiQF5IDEgDyQG5IHECpCxSz6QWAEydkYgY5cEspGxY74frans6w0ydkkgIxk7ScU4rb4Rg4xdS6Q/Y6d/KYmZ+2AVWzDSn7HTeMi7ATJ2FEh9xk56xdp9kbGjQPozdrJL8XxOftePjF1SSX/GTvmAXxNk7CiQgYydfcXOPwTTFvr1RcaOApnI2DH3pfCP+vZFxo4CyNhFATJ2bQUZuwhAxq69IGPXXpCxiwdk7BIGJAbkgcSAPJAYkAcSA/JAYkAeUeL/B9VfnjctGwu+AAAAAElFTkSuQmCC" alt="" />


<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
</head>
<body>
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
<div id="main" style="height:400px"></div>
<!-- ECharts单文件引入 -->
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script src="{weiqiye::STATICS}/wx/echarts/build/dist/echarts.js"></script>
<script type="text/javascript">
// 路径配置
require.config({
paths: {
echarts: '{weiqiye::STATICS}/wx/echarts/build/dist'
}
}); // 使用
require(
[
'echarts',
'echarts/chart/map' // 使用柱状图就加载bar模块,按需加载
],
function (ec) {
// 基于准备好的dom,初始化echarts图表
var myChart = ec.init(document.getElementById('main')); var cityMap = {
"汕尾市": "441500"
}; var curIndx = 0;
var mapType = [];
var mapGeoData = require('echarts/util/mapData/params');
console.log(mapGeoData)
for (var city in cityMap) {
mapType.push(city);
// 自定义扩展图表类型
mapGeoData.params[city] = {
getGeoJson: (function (c) {
var geoJsonName = cityMap[c];
return function (callback) {
$.getJSON('{weiqiye::STATICS}/wx/echarts/geoJson/china-main-city/' + geoJsonName + '.json', callback);
}
})(city)
}
} var ecConfig = require('echarts/config');
var zrEvent = require('zrender/tool/event'); option = {
title: {
text : '',
},
tooltip : {
trigger: 'item',
formatter: '{b}所有景点'
},
series : [
{
name: '',
type: 'map',
mapType: '汕尾市',
selectedMode : 'single',
itemStyle:{
normal:{label:{show:true}},
emphasis:{label:{show:true}}
},
data:[]
}
]
}; // 为echarts对象加载数据
myChart.setOption(option); }
);
</script>
</body>
上一篇:类似No module named 'bs4'等错误的解决方法


下一篇:wpa_supplicant之eloop_run分析