使用百度地图出错,在echarts示例上可以实现,在本地实现不了,代码
var bMap = myChart.getModel().getComponent('bmap').getBMap();
bMap.addControl(new BMap.MapTypeControl({
mapTypes: [
BMAP_HYBRID_MAP,
BMAP_NORMAL_MAP
]
}));
bMap.setMapType(BMAP_HYBRID_MAP);
错误:
Uncaught TypeError: Cannot read property 'getComponent' of undefined
at Object.success (lines-bmap-effect.html:78)
at fire (jquery.js:3501)
at Object.fireWith [as resolveWith] (jquery.js:3631)
at done (jquery.js:9797)
at XMLHttpRequest. (jquery.js:10058)
示例版本和你本地库得版本一样吗?getComponent这个属性是undefined.你打印一下myChat看看有没有etModel()和getComponent
谢谢