questionAccording to the project requirements, we want to highlight (different colors) individual cities in the provincial map below extendFirst, let me introduce how this map is displayed:
Of course, his implementation is very simple First we need to initialize echarts let echartsMap = this.$echarts.init(this.$refs.echartsMap); Register Map this.$echarts.registerMap('河南', dataGeoLocation); //The dataGeoLocation at the back is the map json file we downloaded and then introduced into the current //component for use, and the Henan at the front is the map we want to register Set the option object The configuration here is based on your own project requirements. You can read the documents for detailed introduction. this.echartsDataMap = { visualMap: min: 0, max: 500, show: false, inRange: { color: ['#eac736', '#6EAFE3'].reverse() }, }, globeRadius: 100, globeOuterRadius: 100, geo3D: map: mapName, viewControl: { center: [0, 0, 0], alpha: 100, //Up and down rotation anglebeta: 10, //Left and right rotation angleanimation: true, //Whether to display animationDurationUpdate: 1000, //Animation timedistance: 130, //Distance from view to subjectminBeta: -9999, //Minimum (left) rotation degreemaxBeta: 9999, //Maximum (right) rotation angleautoRotate: false, autoRotateDirection: 'cw', autoRotateSpeed: 10, }, splitArea:{ areaStyle:{ color:'red', } }, light: main: { intensity: 1.2, // color: 'transparent', color: '#0D3867', shadowQuality: 'ultra', shadow: true, alpha: 150, beta: 200 }, ambient: intensity: 1, //ambient light intensity}, ambientCubemap: diffuseIntensity: 1, texture: '' } }, groundPlane: show:false }, postEffect: { enable: false }, itemStyle: { color: '#175096', borderColor: 'rgb(62,215,213)', opacity: 0.8, //transparency borderWidth: 1 }, label: { show:false }, emphasis: label: { show:false }, itemStyle: { } }, silent: false, // Do not respond to or trigger mouse events}, series: [ { type: 'scatter3D', coordinateSystem: 'geo3D', data: this.areaName symbol: 'circle', symbolSize: 0, silent: false, // Do not respond to or trigger mouse events itemStyle: { borderColor: '#fff', borderWidth: 1 }, label: { distance: 30, show: true, formatter: '{b}', position: 'bottom', bottom: '100', textStyle: { color: '#fff', marginTop: 40, fontSize: 16, // fontWeight:'bold', backgroundColor: 'transparent', } } }, { type: 'scatter3D', coordinateSystem: 'geo3D', data: pinArr, color: '#6EAFE3', symbol: 'pin', symbolSize: 56, symbolOffset: ['100%','50%','0'], silent: false, // Do not respond to or trigger mouse events itemStyle: { textAlign: 'center', borderColor: '#6EAFE3', backgroundColor: '#6EAFE3', borderWidth: 0 }, zlevel: -10, label: { show: true, distance: -45, // left: -10, position: 'bottom', formatter: (data) => { return data.value[3] + ' '; }, textStyle: { color: '#333', backgroundColor: 'transparent' } } }, ] }; Put the option instance on our echarts echartsMap.setOption(this.echartsDataMap); Solving the problemLet's look back at the problem at the beginning of the article. I found many ways on Baidu, but after trying, it seems that there is no effect. In fact, I was able to solve it after improving it according to the methods provided on the Internet. This is a more reliable method I found among many methods. Here he said to add regions in geo. In fact, it is like this, but it didn't work after I added it. The reason is that mine is geo3D and his is geo, but it's not a big problem. After trying three times, I finally found that they just have different writing methods. regions: { name: 'Zhengzhou City', / itemStyle: { color: 'green' } },{ name: 'Nanyang City', itemStyle: { color: 'green' } },{ name: 'Shangqiu City', itemStyle: { color: 'green' } }] We just need to correct the color setting and add it to our geo3D. SummarizeThis is the end of this article about echars 3D map custom colors for areas. For more relevant echars 3D map custom colors content, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Graphic tutorial on installing Ubuntu 18.04 on VMware 15 virtual machine
>>: Example analysis of mysql non-primary key self-increment usage
Inject axios into Vue import axios from 'axio...
Table of contents question Reproduction Implicit ...
Vuex is a state management pattern developed spec...
The figure below shows the browser viewing rate i...
Table of contents Inheritance and prototype chain...
In the past, I only knew how to use the name attri...
Preface This article lists several common, practi...
First, let me explain the version of MySQL: mysql...
Currently, almost all large websites and applicat...
I am very happy to attend this episode of potato ...
Table of contents Main topic 1. Install Docker on...
introduce A chart is a graphical representation o...
When faced with a SQL statement that is not optim...
This article shares with you the MySQL 8.0.17 ins...
How to view version information under Linux, incl...