options: { tooltip: { trigger: 'item', showDelay: 0, transitionDuration: 0.2, formatter: function(params) { var value = (params.value + '').split('.') value = value[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1,') return params.name + ': ' + value } }, geo: { roam: false, // 是否开启缩放和平移 zoom: 1, // 当前视角缩放比例 selectedMode: 'single', // 选中模式 aspectScale: 1, // 长宽比 label: { normal: { show: true, textStyle: { color: '#ffffff' } }, emphasis: { show: true } }, // 设置为一张完整经纬度的世界地图 // map: 'world', map: '广东', left: 100, top: 0, right: 100, bottom: 0, itemStyle: { // 地图区域的多边形 图形样式 hoverAnimation: true, normal: { opacity: 0.9, borderWidth: 1, areaColor: '#27A5F9', // 默认的地图板块颜色 borderColor: '#fff' // 地图边框颜色 }, emphasis: { // 点击时候的颜色 areaColor: '#FFDF34', // 默认的地图板块颜色 borderColor: '#fff', // 地图边框颜色 opacity: 1, color: '#fff' } } }, // 旁边的数据范围 gte大于等于 lte小于等于 gt大于 lt小于 visualMap: { min: 0, max: 5000, left: 0, bottom: 0, showLabel: !0, show: true, pieces: [ { gte: 0, lt: 5, color: '#ADC3DA', label: '0-5 人' }, { gte: 5, lt: 10, color: '#FE8B5F', label: '5-10 人' }, { gte: 10, lt: 20, label: '10 - 20 人', color: '#F6BC5B' }, { gte: 20, lt: 30, label: '20- 30 人', color: '#5AB5FF' }, { gte: 30, lt: 100, label: '30- 100 人', color: '#8B6DF6' }, { gt: 100, label: '> 100 人', color: '#F6798A' } ] } }
最主要就是数据的显示了,this.allNumList就是后端返回的数据,这里还有一个坑给大家补充一下,数组返回的数据里面,item里面一定要有name跟value字段,否则数据显示不出来的,我这里就踩坑了,
javascript series: [ { type: 'map', map: '广东', geoIndex: 0, aspectScale: 1, // 长宽比 showLegendSymbol: true, // 存在legend时显示 data: this.allNumList, // 返回的数组 label: { normal: { show: true }, emphasis: { show: true, textStyle: { color: '#fff' } } }, roam: true, itemStyle: { normal: { label: { show: true } }, emphasis: { areaColor: '#FFDF34' } }, animation: true }, { type: 'lines', z: 3, coordinateSystem: 'geo' // data: [] } ],
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/217286.html原文链接:https://javaforall.net
