日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

geojson全国各省市区地图json数据绘制Echarts区域地图

發(fā)布時間:2023/12/20 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 geojson全国各省市区地图json数据绘制Echarts区域地图 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

全國json數(shù)據(jù)獲取地址:

https://github.com/lyhmyd1211/GeoMapData_CN

單獨區(qū)域json數(shù)據(jù)獲取地址:

http://datav.aliyun.com/tools/atlas/#&lat=31.769817845138945&lng=104.29901249999999&zoom=4

利用echarts通過獲取的json文件繪制所需地圖

代碼示例:

renderMap (map, data) {let chart = $echarts.init(document.getElementById('mainTwo'));this.option.dataRange = {x: '10%',y: '8%',splitList: this.arr,show:this.areaStatMax>0?true:false,color: ['#E0022B', '#E09107', '#A3E00B'],textStyle: {color:'#fff',fontSize: 11}}this.option.series = [{name: map,type: 'map',mapType: map,roam: false,layoutCenter: ['50%', '45%'],//距左百分比,距上百分比layoutSize: "80%",//省份地圖大小為600xp。nameMap:{'china':'中國'},zoom: 1,label: {normal:{show:true,textStyle:{color:'#fff',fontSize: 10}},emphasis: {show: true,textStyle:{color:'#fff',fontSize: 12}}},itemStyle: {normal: {areaColor: 'rgba(0,0,0,0)',borderColor: 'dodgerblue',label: {show: true}},emphasis: {areaColor: 'darkorange'},},data: data}]//鼠標移入地圖不變黃色chart.on("mouseover", function() {chart.dispatchAction({type: "downplay"})})//渲染地圖chart.setOption(this.option, true)window.addEventListener("resize", function() {chart.resize()})} let _self = this$.getJSON('../../../static/china.json', function(res){let d = []for( var i=0; i<res.features.length; i++ ){d.push({name: res.features[i].properties.name,value: Math.random()*100})}//注冊地圖$echarts.registerMap('china', res)//繪制地圖_self.renderMap('china', _self.areaStat)//地圖點擊事件document.click = function (e) { return false; }chart.on('click', function (params) {if(_self.num == 0) {_self.$emit("sheng", 1,params.name)}else if( _self.num == 1 ){_self.$emit("city", 2, params.name)} else if (_self.num == 2) {_self.$emit("xian", 3, params.name)}})})

總結(jié)

以上是生活随笔為你收集整理的geojson全国各省市区地图json数据绘制Echarts区域地图的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。