Cannot read property 'extendComponentModel' of undefined at bmap.min.js
See original GitHub issueVersion
4.6.0
Steps to reproduce
根据提示引入dist/echarts.min.js和dist/extension/bmap.min.js,参考https://github.com/apache/incubator-echarts/tree/master/extension/bmap 和https://echarts.apache.org/examples/zh/editor.html?c=heatmap-bmap 编写以下前端代码
<script type="text/javascript" src='../static/js/jquery.min.js'></script>
<script type="text/javascript" src='../static/js/bmap.min.js'></script>
<script type="text/javascript" src='../static/js/echarts.min.js'></script>
<script src="http://api.map.baidu.com/api?v=2.0&ak=***"></script>
<script type="text/javascript">
var myChart = echarts.init(document.getElementById('maps'))
myChart.showLoading();
$.get('../static/json/hangzhou-tracks.json', function (data) {
var points = [].concat.apply([], data.map(function (track) {
return track.map(function (seg) {
return seg.coord.concat([1]);
});
}));
console.log(points);
myChart.hideLoading();
var option = {
animation: false,
bmap: {
center: [120.13066322374, 30.240018034923],
zoom: 14,
roam: true
},
visualMap: {
show: false,
top: 'top',
min: 0,
max: 5,
seriesIndex: 0,
calculable: true,
inRange: {
color: ['blue', 'blue', 'green', 'yellow', 'red']
}
},
series: [{
type: 'heatmap',
coordinateSystem: 'bmap',
data: points,
pointSize: 5,
blurSize: 6
}]
};
myChart.setOption(option);
// 添加百度地图插件
var bmap = myChart.getModel().getComponent('bmap').getBMap();
bmap.addControl(new BMap.MapTypeControl());
});
</script>
//tips:百度密钥在本地是可以正常使用的,此处用*号表示
What is expected?
希望能够生成和示例( https://echarts.apache.org/examples/zh/editor.html?c=heatmap-bmap )中相似的热力图效果
What is actually happening?
- Uncaught TypeError: Cannot read property ‘extendComponentModel’ of undefined at bmap.min.js:22
- Uncaught TypeError: Cannot read property ‘getBMap’ of undefined at Object.success ((index):82) at j (jquery.min.js:2) at Object.fireWith [as resolveWith] (jquery.min.js:2) at x (jquery.min.js:4) at XMLHttpRequest.<anonymous> (jquery.min.js:4)
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Cannot read property 'extendComponentModel' of undefined ...
Version 4.6.0 Steps to reproduce 根据提示引入dist/echarts.min.js和dist/extension/bmap.min.js, ...
Read more >subject:"\[GitHub\] \[echarts\] aaronyyan commented on issue ...
[GitHub] [echarts] aaronyyan commented on issue #12005: Cannot read property 'extendComponentModel' of undefined at bmap.min.js.
Read more >JQuery & Echarts: Cannot read property 'getProgressive' of ...
I encountered a strange error when using Jquery and echarts: Cannot read property 'getProgressive' of undefined. My code went like:
Read more >TypeError: Cannot read property 'b' of undefined
Hi everyone, This is a new error that I cannot find on the Jitsi Community. I downloaded the latest Jitsi Meet and put...
Read more >echarts@5.4.1 - jsDocs.io
getInstanceByDom: (dom: HTMLElement) => EChartsType | undefined; ... util/component.js'; ... Set visual property of single data item ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
echarts.min.js
需要放在bmap.min.js
之前引入,不然会报 echarts undefined另外,如果项目使用的打包环境,不要使用CDN方式引入
echarts.min.js
和bmap.min.js
,只需要引入一个http://api.map.baidu.com/api?v=2.0&ak=***
在代码中:https://tva1.sinaimg.cn/large/008i3skNgy1gqvtifhuu5j30f80fa75d.jpg 目录下是有的,我换成
import _m from 'echarts/extension/bmap/BMapView';
可以