Echarts使用百度地图例子
Echarts结合百度地图使用,下面是一个简单使用的例子。
需要加载的js如下:
echarts.min.js 官方地址:https://www.echartsjs.com
bmap.js 目录:incubator-echarts-x.x.x/dist/extension/bmap.js
http://api.map.baidu.com/api?v=3.0&ak=yourkey 官方地址:http://lbsyun.baidu.com/
html代码只需定义一个容器即可,如下:
<div id="main" style="width: 1550px;height:700px;"></div>
js代码:
需要加载的js如下:
echarts.min.js 官方地址:https://www.echartsjs.com
bmap.js 目录:incubator-echarts-x.x.x/dist/extension/bmap.js
http://api.map.baidu.com/api?v=3.0&ak=yourkey 官方地址:http://lbsyun.baidu.com/
html代码只需定义一个容器即可,如下:
<div id="main" style="width: 1550px;height:700px;"></div>
js代码:
var myChart = echarts.init(document.getElementById('main'));
var option = {
bmap : {
center : [ 121.511644,31.302943 ],
zoom : 17,
roam: true
},
geo : {
map: 'bmap',
type: 'map'
},
series : []
};
myChart.setOption(option);