BaiduMapChart调用说明:

1. BaiduMapChart依赖库:

依赖库:

jquery.min.js, bootstrap.min.js, underscore-min.js, crossfilter.js, d3.min.js, dc.js, queue.js, leaflet.js,

leaflet-heat.js, leaflet-baidu.js, baiduMapAPI-2.0-min.js

百度地图chart下载:BaiduMapChart

2. 创建:

代码示例:

var mapChart = dc.BaiduMapChart("#map");

3. 调用:

代码示例:

mapChart
	.width(900)
	.height(600)
	.dimension(allDim)
	.center([31.207391, 121.608203])
	.maptyppe('bluish')
	.zoom(11);

4. api说明:

函数dimension()

参数为crossfilter中的dimension变量。

函数center()

传入数据格式为[纬度,经度],定义地图中心点的坐标。

函数zoom()

传入一个数字,作用是调整地图缩放比例。(在leaflet-baidu.js中规定范围为[3,19])

函数maptype()

传入数据应该为字符串,规定默认加载地图格式,目前包括:normal,satellite,road,cnormal,light,dark,redalert,googlelite,grassgreen,midnight,pink,darkgreen,bluish,grayscale,hardedge共15种。

不同模式地图展示示例如下:

normal模式示例图satellite模式示例图satellite模式示例图
normal模式satellite模式bluish模式

完整代码:

 

完整代码示例

致谢:

在地图调用过程中使用到了leaflet插件

调用百度地图还需要百度地图的api

感谢Tiven制作的leaflet百度地图

版权: 中国石油大学华东可视分析小组

联系人:李昕 邮箱:lix@upc.edu.cn