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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

echarts地图的基本使用配置

發(fā)布時間:2023/12/10 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 echarts地图的基本使用配置 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

一、空氣質(zhì)量圖

代碼和配置如下:

<template><div class="box"><div id="map"></div></div> </template><script>import china from 'echarts/map/js/china.js' export default {data(){return {}},mounted(){this.mapFn()},methods:{mapFn(){// 基于準(zhǔn)備好的dom,初始化echarts實(shí)例var mapChart = this.$echarts.init(document.getElementById('map'));mapChart.setOption({backgroundColor: '#404a59', //背景顏色title: {text: '全國主要城市空氣質(zhì)量',subtext: 'data from PM25.in',sublink: 'http://www.pm25.in',x:'center',},legend: { //圖例組件。orient: 'vertical',y: 'bottom',x:'right',data:['pm2.5'],textStyle: {color: '#fff'}},//是視覺映射組件,用于進(jìn)行『視覺編碼』,也就是將數(shù)據(jù)映射到視覺元素(視覺通道)。visualMap: {min: 0, //最小值max: 600, //最大值calculable: true, //是否顯示拖拽用的手柄(手柄能拖拽調(diào)整選中范圍)。inRange: {color: ['#4cb0dd', '#2d79ad', '#265da0'] //顏色},textStyle: {color: '#fff'},},// 提示框,鼠標(biāo)移入tooltip:{show:true, //鼠標(biāo)移入是否觸發(fā)數(shù)據(jù)trigger: 'item', //出發(fā)方式formatter:'{b}-銷售數(shù)量:{c}'},//配置地圖的數(shù)據(jù),并且顯示series:[{name:'地圖',type: 'map', //地圖種類map: 'china', //地圖類型。data:[{name: '北京',value: Math.round(Math.random()*500)},{name: '天津',value: Math.round(Math.random()*500)},{name: '上海',value: Math.round(Math.random()*500)},{name: '重慶',value: Math.round(Math.random()*500)},{name: '河北',value: Math.round(Math.random()*500)},{name: '河南',value: Math.round(Math.random()*500)},{name: '云南',value: Math.round(Math.random()*500)},{name: '遼寧',value: Math.round(Math.random()*500)},{name: '黑龍江',value: Math.round(Math.random()*500)},{name: '湖南',value: Math.round(Math.random()*500)},{name: '安徽',value: Math.round(Math.random()*500)},{name: '山東',value: Math.round(Math.random()*500)},{name: '新疆',value: Math.round(Math.random()*500)},{name: '江蘇',value: Math.round(Math.random()*500)},{name: '浙江',value: Math.round(Math.random()*500)},{name: '江西',value: Math.round(Math.random()*500)},{name: '湖北',value: Math.round(Math.random()*500)},{name: '廣西',value: Math.round(Math.random()*500)},{name: '甘肅',value: Math.round(Math.random()*500)},{name: '山西',value: Math.round(Math.random()*500)},{name: '內(nèi)蒙古',value: Math.round(Math.random()*500)},{name: '陜西',value: Math.round(Math.random()*500)},{name: '吉林',value: Math.round(Math.random()*500)},{name: '福建',value: Math.round(Math.random()*500)},{name: '貴州',value: Math.round(Math.random()*500)},{name: '廣東',value: Math.round(Math.random()*500)},{name: '青海',value: Math.round(Math.random()*500)},{name: '西藏',value: Math.round(Math.random()*500)},{name: '四川',value: Math.round(Math.random()*500)},{name: '寧夏',value: Math.round(Math.random()*500)},{name: '海南',value: Math.round(Math.random()*500)},{name: '臺灣',value: Math.round(Math.random()*500)},{name: '香港',value: Math.round(Math.random()*500)},{name: '澳門',value: Math.round(Math.random()*500)},{name: '南海諸島',value: Math.round(Math.random()*500)}],itemStyle: { //地圖區(qū)域的多邊形 圖形樣式。emphasis:{ //高亮狀態(tài)下的樣試label:{show:true,}}},zoom:1,//放大比例label: { //圖形上的文本標(biāo)簽,可用于說明圖形的一些數(shù)據(jù)信息show:true,},},{type:'scatter',showEffectOn: 'render',//配置什么時候顯示特效coordinateSystem:'geo',//該系列使用的坐標(biāo)系symbolSize:10,//標(biāo)記的大小data:[{name: '宜昌', value: [111.3,30.7,130]},],zlevel:99999},]})}} } </script><style scoped> .box{margin-top:20px; } #map{width:1200px;height:720px; } </style>

 

二、散點(diǎn)圖。geo

代碼和配置:

<template><div class="box"><div id="chart"></div></div> </template><script> import china from 'echarts/map/js/china.js' export default {mounted(){this.mYChart()},methods:{mYChart(){var mapChart = this.$echarts.init(document.getElementById('chart'));mapChart.setOption({backgroundColor: '#404a59',title: {text: '主標(biāo)題',subtext: '副標(biāo)題',sublink: 'http://www.pm25.in',left: 'center'},//地理坐標(biāo)系組件用于地圖的繪制,支持在地理坐標(biāo)系上繪制散點(diǎn)圖,線集。//要顯示散點(diǎn)圖,必須填寫這個配置geo:{show:true,roam: true, //是否允許鼠標(biāo)滾動放大,縮小map:'china',label: { //圖形上的文本標(biāo)簽,可用于說明圖形的一些數(shù)據(jù)信息show:true, //是否顯示文本color:'#CCC', //文本顏色},itemStyle: { //地圖區(qū)域的多邊形 圖形樣式。 默認(rèn)樣試。areaColor: '#323c48', //地圖區(qū)域的顏色。borderColor: '#111', //邊框線},emphasis:{ //高亮狀態(tài)下的多邊形和標(biāo)簽樣式。label:{ //文本color: '#ADA',},itemStyle:{ //區(qū)域areaColor: '#F60'}},data:[{name: '北京',value: Math.round(Math.random()*500)},{name: '天津',value: Math.round(Math.random()*500)},{name: '上海',value: Math.round(Math.random()*500)},{name: '重慶',value: Math.round(Math.random()*500)},{name: '河北',value: Math.round(Math.random()*500)},{name: '河南',value: Math.round(Math.random()*500)},{name: '云南',value: Math.round(Math.random()*500)},{name: '遼寧',value: Math.round(Math.random()*500)},{name: '黑龍江',value: Math.round(Math.random()*500)},{name: '湖南',value: Math.round(Math.random()*500)},{name: '安徽',value: Math.round(Math.random()*500)},{name: '山東',value: Math.round(Math.random()*500)},{name: '新疆',value: Math.round(Math.random()*500)},{name: '江蘇',value: Math.round(Math.random()*500)},{name: '浙江',value: Math.round(Math.random()*500)},{name: '江西',value: Math.round(Math.random()*500)},{name: '湖北',value: Math.round(Math.random()*500)},{name: '廣西',value: Math.round(Math.random()*500)},{name: '甘肅',value: Math.round(Math.random()*500)},{name: '山西',value: Math.round(Math.random()*500)},{name: '內(nèi)蒙古',value: Math.round(Math.random()*500)},{name: '陜西',value: Math.round(Math.random()*500)},{name: '吉林',value: Math.round(Math.random()*500)},{name: '福建',value: Math.round(Math.random()*500)},{name: '貴州',value: Math.round(Math.random()*500)},{name: '廣東',value: Math.round(Math.random()*500)},{name: '青海',value: Math.round(Math.random()*500)},{name: '西藏',value: Math.round(Math.random()*500)},{name: '四川',value: Math.round(Math.random()*500)},{name: '寧夏',value: Math.round(Math.random()*500)},{name: '海南',value: Math.round(Math.random()*500)},{name: '臺灣',value: Math.round(Math.random()*500)},{name: '香港',value: Math.round(Math.random()*500)},{name: '澳門',value: Math.round(Math.random()*500)},{name: '南海諸島',value: Math.round(Math.random()*500)}],},tooltip:{show:true,},//是視覺映射組件,用于進(jìn)行『視覺編碼』,也就是將數(shù)據(jù)映射到視覺元素(視覺通道)。visualMap: {min: 0, //最小值max: 600, //最大值calculable: true, //是否顯示拖拽用的手柄(手柄能拖拽調(diào)整選中范圍)。inRange: {color: ['#e83e5e','#fb2a08', '#d6f628'] //顏色},textStyle: {color: '#fff'},},series:[{type:'effectScatter', //樣試coordinateSystem:'geo', //該系列使用的坐標(biāo)系data:[ //數(shù)據(jù){name: '宜昌', value: [111.3,30.7,330]},{name: '信陽', value: [114.089435,32.167686,440]},{name: '北京', value: [116.422586,39.921549,560]}],itemStyle: { //樣試。normal:{ //默認(rèn)樣試color: '#d6f628' }},label: {normal: {formatter: '{b}',position: 'right',show: true}},//標(biāo)記的大小,可以設(shè)置數(shù)組或者函數(shù)返回值的形式symbolSize: function (val) {return val[2] / 25;}, rippleEffect: { //漣漪特效相關(guān)配置。brushType: 'stroke' //波紋的繪制方式},hoverAnimation: true, //鼠標(biāo)移入放大圓}]}),mapChart.on('click',function(data){console.log(data)})}} } </script><style scoped> .box{margin-top:30px; } #chart{width: 1000px;height: 620px; } </style>

 

三、vue里面使用。bmap 百度地圖

<template><div class="bxo"><div id="bmap"></div></div> </template><script> import bmap from 'echarts/extension/bmap/bmap.js' export default {data(){return{}},mounted(){this.bmapFn()console.log("加載")}, methods:{bmapFn(){var mapChart = this.$echarts.init(document.getElementById('bmap'));mapChart.setOption({title:{text:'地圖s'},bmap: {center: [116.307698, 40.056975], // 中心位置坐標(biāo)zoom: 5, // 地圖縮放比例roam: true, // 開啟用戶縮放mapStyle: {styleJson: [{ //地圖樣試'featureType': 'water','elementType': 'all','stylers': {'color': '#d1d1d1'}}, {'featureType': 'land','elementType': 'all','stylers': {'color': '#f3f3f3'}}, {'featureType': 'railway','elementType': 'all','stylers': {'visibility': 'off'}}, {'featureType': 'highway','elementType': 'all','stylers': {'color': '#fdfdfd'}}, {'featureType': 'highway','elementType': 'labels','stylers': {'visibility': 'off'}}, {'featureType': 'arterial','elementType': 'geometry','stylers': {'color': '#fefefe'}}, {'featureType': 'arterial','elementType': 'geometry.fill','stylers': {'color': '#fefefe'}}, {'featureType': 'poi','elementType': 'all','stylers': {'visibility': 'off'}}, {'featureType': 'green','elementType': 'all','stylers': {'visibility': 'off'}}, {'featureType': 'subway','elementType': 'all','stylers': {'visibility': 'off'}}, {'featureType': 'manmade','elementType': 'all','stylers': {'color': '#d1d1d1'}}, {'featureType': 'local','elementType': 'all','stylers': {'color': '#d1d1d1'}}, {'featureType': 'arterial','elementType': 'labels','stylers': {'visibility': 'off'}}, {'featureType': 'boundary','elementType': 'all','stylers': {'color': '#fefefe'}}, {'featureType': 'building','elementType': 'all','stylers': {'color': '#d1d1d1'}}, {'featureType': 'label','elementType': 'labels.text.fill','stylers': {'color': '#999999'}}]}}})}} } </script><style scoped> .box{margin-top:20px; } #bmap{width: 1000px;height: 620px; } </style>

  

轉(zhuǎn)載于:https://www.cnblogs.com/chengxiang123/p/10108062.html

總結(jié)

以上是生活随笔為你收集整理的echarts地图的基本使用配置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

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