实际项目中用echarts绘制的相关地图,热力图层,点,背景等都可修改,点位可点击。
注意事项:
项目中安装的echarts版本必须是4.9.0的,
"echarts": "^4.9.0", "echarts-countries-js": "^1.0.5", "echarts-gl": "^1.1.2"
效果如下图所示:
相关完整的组件代码:
<template> <!-- 地图 --> <div style="width: 100%; position: relative" :style="{ height: height }"> <div id="main" :style="{ height: height,width:width }"></div> </div> </template> <script type="text/ecmascript-6"> let bdJson; export default { props:{ height:{ type:String, default:'550px' }, width:{ type:String, default:'100%' }, MapBtnNum:{ type:Number, default:0 }, pointList:{ //相关标记点的数组 type:Array, default:()=>[ { name: '业委会一', value: [117.253931,34.870574], datas: 1354, message:'这里展示的相关待定的信息', img : 'image://data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAA1CAYAAADVn2JsAAAAAXNSR0IArs4c6QAADeBJREFUaEPtmQlwFOeVx9/7uqdnejQjjRACncBw6eKSxCHMJQwOMfERJ17H2draTVW8KRf2rlljilTWyWq9td7yvZiEtSmRVChvKpu4XKnEa0iwuQ8LGwxCIGHQxSUOCZ0zPdPd3/e2Xo/A9iYYyWhTm6p0lYRqpj/61//+v+trhD/BA/8EmeHP0H+sp/Znpa8rTQC4ofqOrysHD63ev//sSD+BEVf6R9ULFuqaeBkQ5xCRBUQvSaU/99iuXQMjBT9i0BsWz41quvGcLsSDAIDKlf1C18IMqog6FNE/Xtmx76c1AOp24W8b+tV589IDId/3CPAJAAgAKXugp+/4ufYLDeFwWkZeYf4dwvCNYVAC+EgnXP3Ijj17bgf8C0P/BYC2ZOnCb+sIzwjEsQxhDQw0nTt74UgsbsU/DVWQlxMdPTZ7LmhaGInIIXhTSXvd3+051PpF4L8Q9MbqquUo9JcQYIanoONeuXDuwr6u7p5rN4MwdJ8+blzetLRI+gxAYQBBAhDW2zHn2b+vq+sbDvywoP99wYIiwwcvoMB7vYsQ9XVeunqo42pnOyIiAdKgDQCkIrpuX3YxESEoTAuawYKC3AozHC7mi0uiy1KpH+zefXDzLwH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0WXN9YfPTa6eA4zwvlLofEDCeSPbXHTvx4eGTp7w9OW9iSaEN4g/6efBzfixZ6aG0JXMrZ0UL84vY56hplyWJfzpnpm9eWlPj3gr4Dz7MoSw6vfrRak33vQwI5SxRT3f3lR0HDh1ovnCp82brg37Dt2j2rGmlRZOn67rPAKAESbVeOeLZKRs2/N/t5X0aiGpqRNvAtb8hoH8FpXLZjK3t55p21n14pKuv/zO7plXTSyfNnj5tthkM8H41AWpvClDrJrz4wz/erumn4U+sWhUy07R1JNUaQDBd6dqNTWeO7z18tCFvzOjM6nlzqiKZkTEeK4oPiOSTk17auG8oT/Rm5wzL0593oaanHo8aAM+RUg8yn2XbA6bfCLHBURPngcT3oi+9+gZXxNsB/sKe/ryLNq9ZtRAAXwbAOUgUI8AXzAH7hbxNmz5jmdsBHzGlP+N3AGz/7pNfSybp/aJXXrlwO4C3nfJudnEi+isA4FcYWwEgBACFAMBVjUXhf7lQRBHxlnvPQ7nBEVGaiMoBYC4AaADAGeJh3jcfBK4DAC4YYxDx+aFA3eqckYK+CwBKAcAAAC4QswBgJQBcBoCfDUK4/9+gpwLAwkGLcMAx+DgA6AaAGO+bs20Q8V9upeJQvh8ppdkW7Ol7AIBfQyQBoB8AgoOb/fzZUUR8ZyhQtzpnRKC9foNfXgFMBIC/BQB+pcw/3FrzwHsYAN5GxJ5bAQ3l+xGDHgQ3AeARALiPIQFgCgDkAcAPELFhKEBDOWdEoQfBcwGAXznfz9sfAPAsZw9E5NQ3IseIQw+CFwHAWgA4BgA/RkQOxhE7/gcUU/uQSqd0cQAAAABJRU5ErkJggg==' },{ name: '业委会二', value: [117.697883,34.695889], datas: 1354, message:'这里展示的相关待定的信息', img : 'image://data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAA1CAYAAADVn2JsAAAAAXNSR0IArs4c6QAADQFJREFUaEPtmQtwVFWax7/vnHtvd6eTJiEhTwIJDwMBEbp5GwEHLUIU5KHi7KhQis7UyK67sgyW62rr1liFOIwzTr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AJACsQUQZjwo7/AT2sNpD/2GPlAAAAAElFTkSuQmCC' },{ name: '业委会三', value: [117.487563,35.132384], datas: 1354, message:'这里展示的相关待定的信息', img : 'image://data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAA1CAYAAADVn2JsAAAAAXNSR0IArs4c6QAADhJJREFUaEPtmQmQVdWZx7/vnHPvfXsv0K/pRZqtF5qmu9kaAkYUNBhjBFzGOBNrUhknzozBGGQKR422OpEixgUrIZlJMIsIE0mGcmKECcT0jAmytewiWwMNDU3T/bZ+2733LFPnvTaaik4auitFqnK6Xr+q+95993e/8z//7/vORfgzHPhnyAx/gf5TzdpfIv2hSGPJg2Nv4y7ujL7Y0TncMzDskS5ZPu5qgvgcIM4AgIwE9SzEEysvrr6YHC74YYMuXVY1FqixEijcDoBIQPVLwCAigBTyvJLqkYu+jh9BK8ihwg8ZunjJhJARhIdBwVcAwIOITsC1DxTEUwcdixVEQ4HZrsQwAIICtYcSfOD814/971DALx/6DqDhMeP/Dhk+iQRLlQLwCve9okTyHcPh6Q9D9Yf8Y+Neb4sADAIoBQJ+CsJdfuGbp09eDvxlQZc+VH09IDwLCI2gECyqeor7U9s8Kbfv4yAkRSNaGJiUZGyyVGACqCwCrLJFaEV0ZXv8UuAvCbr8XybXCbCfQYI3IxBgBBKFGXd3sN/pREpASQKSAJA/yFlqgEmCy9AXCZhNGUprARRIoS6ggMdrvZ9b09baygcDPyjowtYxhR7b/Boi3gdILEowG5TqYHE/P4KKCUSKEhGBkNw1xYd+VR/BAWYiJYCSCpSErKmKev3GTFvKEqUkKCX3SyDLep4+vOWPgf//0NcCC7dM+BJh2ApIShCJCkg4PCIjDhmCZpFYBJmBEhmCtgmkqPLcvzf0RYj2DCW0pBUIrlC6SghbJrxYGbVgmitVKAcv5etC8mW93zh55OPgPxa65NHxNxKO3wTESUgQPATPjUjxnd4sJijzEGBegsxDc9CUIgBDIFRLXOMrqVemjrKeAQ2tcloABK5ACAXcVZKnBXBbcmVjX5D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G4F2q1SyTNfL/WfPHY3sOLiXx5Jp3cFIDa4UhJomjCuaXDuNWVZA64Ao+lPh0IfWffL5jkG40B98ZVB7eR+clVftQAebe/vib5cHXCO9XIJaCgBeJYQTOdZxILZz/0FzVElRycymWZ6CgnCuZ0TYJaRaun7W6t9cDuz751wi9Mdf6u4dXx4LACsFyNtzOwVZJ0k8ZiC3NJGcRVQPvzz922tz3dkQx7BBv89x1/Z/upoSfA4BZ0hQKUR8Jo7OMz+f/u+/t9E+FO5hhx6QDn5x99Jbuau2/3j2811DAfyoc4cFWin1eQAoBYBNAKAlcRUAuPkOPPeuE8VYRNw6HDcwXNBTAKBFbyoBQBAAPgcAxQPAOwBAJ4wwIn7jSoK+AQDqAfSzFNCPIJoB4CYAuAAA6wZA+ZUGXQMAVw9IRC84DT4aAKIAkAIA3SsGEPGpKynSWhZa0zcDQEhvgwBAPwD4BqonfWwvIr5xxUBrEKVyiWccAPy97mEHXjqXa/9uB4DXETF2RUEPgHsB4B4AuEVDAkA1AOhO/DFEPDgcwLnMOlw/9LvsrlQZQO6R80IA0A9Dn9bugYja+oZlDDv0QMR1O/bPALAPAF5CRL0Yh238H6z5CZ+wMUWqAAAAAElFTkSuQmCC' } ] }, heatList:{ //热力地图标记展示的数组 type:Array, default:()=>[ { name:'点一', coor:[117.463632,35.11275], value:10 },{ name:'点二', coor:[117.464495,35.108587], value:450 },{ name:'点三', coor:[117.458566,35.110742], value:110 },{ name:'点四', coor:[117.457632,35.113784], value:1100 },{ name:'点五', coor:[117.572337,34.872095], value:1100 } ] }, mapAbout:{ //map的相关属性的设置 type:Object, default:()=>{ return{ mapBg:require('../../../assets/indexNormal/mapBg.jpg'), //地图的覆盖图片 mapHoverBg:require('../../../assets/indexNormal/mapBg.jpg'), visualMapMax:100, //这是热力地图展示的最大值,用来控制颜色的展示 inRangeColor:['#D14137','#E7CF1A','#22B536','#047ACF'], //这是展示的颜色,顺序依次为从大到小 geoAspectScale:0.75, //这里是贴图与背景展示的关系 geoLeft:'19%', //控制贴图的位置' geoLayoutSize:'88%', //这个控制贴图大小 geoSilent: true, //图形是否不响应和触发鼠标事件,默认为 false,即响应和触发鼠标事件。 geoRoam: true, //是否开启鼠标缩放和平移漫游 geoScaleMin:1.1,//滚轮缩放的最小值 geoScaleMax:2.2,//滚轮缩放的最大值 geoZoom:1.1, //这是底部背景的大小 mapAreaColor: '#0DD3E4', //这是底下偏移的柱子的颜色 mapShadowColor: 'RGBA(13, 211, 228, 0.9)', //外发光的颜色 mapShadowBlur: 20, //外发光的距离 mapShadowOffsetX: 0, mapShadowOffsetY: 0, mapBorderColor: 'rgba(0, 0, 0, 0.7)', //底下地图描边的颜色 mapBorderWidth: 0, //底下地图描边的大小 } } }, series:{ //series的相关树形设置 type:Object, default:()=>{ return{ labelShow:true, //文字是否展示 labelColor:'#ffffff', //文字展示的颜色 labelHoverColor:'#ffffff', //鼠标滑过文字展示的颜色 mapBorderColor: '#2ab8ff', //这个是各个区域描边的线 mapBorderWidth: 1, //区域描边的大小 mapShadowColor: 'rgba(0, 0, 0, 0.5)', //描边的的shadow mapShadowBlur: 0, //描边的的shadow的发光 mapShadowOffsetX: 0, mapShadowOffsetY: 1, mapHoverBorderColor: '#2ab8ff', //鼠标滑过的描边的颜色 mapHoverBorderWidth: 1, //鼠标滑过的描边的带线啊哦 mapHoverShadowColor: 'rgba(0, 255, 255, 0.7)', //鼠标滑过的阴影的颜色 mapHoverShadowBlur: 10, //鼠标滑过的阴影的发光的大小 mapHoverShadowOffsetX: 0, mapHoverShadowOffsetY: 1, zoom:1.06, //展示在屏幕上合适的大小 roam: true, //是否开启鼠标缩放和平移漫游 left:'19%', //调整展示距离 min:1.06, //最小 max:2.2, //最大 symbolSize: [20, 24], //点的大小 symbolOffset: [0, -20], //点移动的距离 } } }, }, data() { return { indexMap: '', } }, created(){ bdJson = require('../../../assets/json/bd.json') }, methods: { initMap() { let that = this; var myChart = that.$echarts.init(document.getElementById('main')); that.indexMap = myChart var bd = bdJson; var mapname = bd; var mapDate = this.pointList //这是相关热力地图的数组数据start var heatList = this.heatList var geoCoordMap = {} heatList.map(item => { geoCoordMap[item.name] = item.coor // 根据自己需求可以拼接 }) var convertData = function (data) { var res = []; for (var i = 0; i < data.length; i++) { var geoCoord = geoCoordMap[data[i].name]; if (geoCoord) { res.push(geoCoord.concat(data[i].value)); } } return res; }; //热力图end //标注的点的base64的图片 var domImg = document.createElement('img'); domImg.style.height = domImg.height = domImg.width = domImg.style.width = '500px'; domImg.src = that.mapAbout.mapBg var domImgHover = document.createElement('img'); domImgHover.style.height = domImgHover.height = domImgHover.width = domImgHover.style.width = '8px'; domImgHover.src = that.mapAbout.mapHoverBg myChart.showLoading('default', { text: '加载中...', maskColor: 'rgba(0,0,0,0)', textColor: '#fff', }); myChart.on('click', function (e) { mapDate.forEach(item=>{ if(e.name == item.name){ //这里是点的标注的点击事件,根据实际情况来 // that.$emit('showInfo',item) } }) }); setTimeout(function () { mapInit(); }, 1000); var mapInit = () => { that.$echarts.registerMap('bd', mapname); that.indexMap.hideLoading(); that.indexMap.setOption({ //热力地图展示 visualMap: { min: 0, max: that.mapAbout.visualMapMax, splitNumber: 4, inRange: { color: that.mapAbout.inRangeColor.reverse() }, // textStyle: { // color: '#fff' // }, show:false, }, //TODO geo 展示的点 geo: { map: 'bd', aspectScale: that.mapAbout.geoAspectScale, left: that.mapAbout.geoLeft, layoutSize: that.mapAbout.geoLayoutSize, silent: that.mapAbout.geoSilent, //图形是否不响应和触发鼠标事件,默认为 false,即响应和触发鼠标事件。 roam: that.mapAbout.geoRoam, //是否开启鼠标缩放和平移漫游 scaleLimit:{ //滚轮缩放的极限控制 min:that.mapAbout.geoScaleMin, max:that.mapAbout.geoScaleMax }, z: 0, zoom: that.mapAbout.geoZoom, itemStyle: { areaColor:that.mapAbout.mapAreaColor, //这是底下偏移的柱子的颜色 shadowColor: that.mapAbout.mapShadowColor, //外发光的颜色 shadowBlur: that.mapAbout.mapShadowBlur, //外发光的距离 shadowOffsetX: that.mapAbout.mapShadowOffsetX, shadowOffsetY: that.mapAbout.mapShadowOffsetY, borderColor: that.mapAbout.mapBorderColor, //底下地图描边的颜色 borderWidth: that.mapAbout.mapBorderWidth, //底下地图描边的大小 }, }, series: [ { name:'覆盖图层', type: 'map', label: { show: that.series.labelShow, textStyle: { color: that.series.labelColor, }, emphasis: { textStyle: { color: that.series.labelHoverColor, }, }, }, itemStyle: { borderColor: that.series.mapBorderColor, //这个是各个区域描边的线 borderWidth: that.series.mapBorderWidth, areaColor: { image: domImg, repeat: 'repeat', }, shadowColor: that.series.mapShadowColor, //描边的的shadow shadowBlur: that.series.mapShadowBlur, shadowOffsetX: that.series.mapShadowOffsetX, shadowOffsetY: that.series.mapShadowOffsetY, emphasis: { //这是鼠标划上的高亮的显示的样式 areaColor: { image: domImgHover, repeat: 'repeat', }, borderColor: that.series.mapHoverBorderColor, borderWidth: that.series.mapHoverBorderWidth, shadowColor: that.series.mapHoverShadowColor, shadowBlur: that.series.mapHoverShadowBlur, shadowOffsetX: that.series.mapHoverShadowOffsetX, shadowOffsetY: that.series.mapHoverShadowOffsetY, label: { show: false, }, }, }, zoom: that.series.zoom, // silent: false, //图形是否不响应和触发鼠标事件,默认为 false,即响应和触发鼠标事件。 roam: that.series.roam, left:that.series.left, scaleLimit:{ min:that.series.min, max:that.series.max }, map: 'bd', }, //坐标点 { name:'点标注', coordinateSystem: 'geo', itemStyle: { color: 'rgba(0,0,0,1)', }, // symbol: pointImg, symbol: function (value, params) { return params.data.img; }, symbolSize: that.series.symbolSize, symbolOffset: that.series.symbolOffset, z: 9999, data: mapDate, type:'effectScatter', //动效展示 rippleEffect: { scale: 3, brushType: 'stroke', }, }, { name: '热力图层', type: 'heatmap', coordinateSystem: 'geo', data: convertData(that.heatList), z: 3, silent: false, //图形是否不响应和触发鼠标事件,默认为 false,即响应和触发鼠标事件。 roam: false, }, ], }); }; //两层一起滚动拖拽 that.indexMap.on('georoam',function(params){ var option = that.indexMap.getOption();//获得option对象 if(params.zoom!=null&¶ms.zoom!=undefined){ //捕捉到缩放时 option.geo[0].zoom=option.series[0].zoom;//下层geo的缩放等级跟着上层的geo一起改变 option.geo[0].center=option.series[0].center;//下层的geo的中心位置随着上层geo一起改变 }else{//捕捉到拖曳时 if(option.geo[0].center!=null&&option.geo[0].center!=undefined){ option.series[0].center = option.geo[0].center }else{ option.geo[0].center = option.series[0].center } } that.indexMap.setOption(option);//设置option }); }, }, mounted() { var that = this // 新建一个promise对象 let newPromise = new Promise((resolve) => { resolve() }) //然后异步执行echarts的初始化函数 newPromise.then(() => { that.initMap() }) }, } </script> <style scoped lang="scss"> .indexMapBack{ width: 70px; height: 73px; position: absolute; top:20px; left: 20px; cursor: pointer; } .centerRight { width: 260px; height: 200px; background: url("../../../assets/indexNormal/mapShow.png") no-repeat; background-size: 100% 100%; position: absolute; top: 0px; right: 0px; .title { font-size: 18px; color: #ffffff; text-align: center; padding-top: 30px; } .message { font-size: 14px; color: #ccefff; padding: 5px 10px 5px 15px; span { color: #ffc106; } } .closeRight { position: absolute; top: -2px; right: 7px; font-size: 20px; color: #ffffff; cursor: pointer; } } </style> <style> .anchorBL { display: none; } </style>
展示的相关区县官方json文件的获取方法:
然后输入相关的市的展示,点击其他类型的下载或粘贴即可获取相对应的json
标签:鼠标,series,力图,echarts,option,var,绘制,mapAbout,name From: https://www.cnblogs.com/menxiaojin/p/18632982