Recently, the company is working on a street map project. Before, it used the maps provided by Echart directly, but this time, it was not easy for Echart to get the street map of the whole country. (This specific research was not done), so it directly connected with Baidu Map. To use Baidu Map, you must first go to the official website to apply FOR AK. Baidu 2.0 already supports HTTPS access. Init (){// prevent the page from warning that the DOM already exists

if(this.myChart && this.dispose) { this.myChart.dispose(); this.myChart = null; }! this.myChart && (this.myChart = echarts.init(document.getElementById('main'))); this.options && this.myChart.setOption(this.options, true); Var bmap = this.mychart.getModel ().getComponent('bmap').getBmap (); // Set the display range of Baidu Map beyond bounce, to use this function, also need to introduce <! --<script type="text/javascript" SRC = "https://api.map.baidu.com/library/AreaRestriction/1.2/src/AreaRestriction_min.js" > < / script > -- > var b = new Bounds(new Map.point (116.027143, 39.772348),new Map.point (116.832025, 40.126349)); try { BMapLib.AreaRestriction.setBounds(bmap, b); } catch (e) { ; }}Copy the code