chaofan-rensheng commented on issue #10985: echarts中使用bmap时候showTip无效
URL: 
https://github.com/apache/incubator-echarts/issues/10985#issuecomment-519756670
 
 
   @deyihu 
   `
   data() {
       return {
         myEacharts: null,
         geoCoordMap: {
           '杭州': [120.19, 30.26]
         }
       }
     },
     mounted() {
       this.initEcharts()
     },
   
     methods: {
       initEcharts() {
         this.myEacharts = echarts.init(document.getElementById(this.id))
         this.setOptions()
       },
   
       convertData(data) {
         var res = []
         for (var i = 0; i < data.length; i++) {
           var geoCoord = this.geoCoordMap[data[i].name]
           if (geoCoord) {
             res.push({
               name: data[i].name,
               value: geoCoord.concat(data[i].value)
             })
           }
         }
   
         return res
       },
   
       setOptions() {
         var option = {
           // backgroundColor: 'red',
           tooltip: {
             trigger: 'item',
             padding: 0,
             enterable: true,
             triggerOn: 'none',
             transitionDuration: 1,
             textStyle: {
               color: 'red',
               decoration: 'none'
             },
             formatter: function(params) {
               var tipHtml = '<div class="tipHtml">' + '000000' + '</div>'
               return tipHtml
             }
   
           },
   
           bmap: {
             center: this.mapData,
             zoom: 12,
             roam: true,
             background: '#33345F',
             mapStyle: {
               styleJson: [
                 {
                   'featureType': 'water',
                   'elementType': 'all',
                   'stylers': {
                     'color': '#031628'
                   }
                 },
                 {
                   'featureType': 'land',
                   'elementType': 'geometry',
                   'stylers': {
                     'color': '#000102'
                   }
                 },
                 {
                   'featureType': 'highway',
                   'elementType': 'all',
                   'stylers': {
                     'visibility': 'off'
                   }
                 },
                 {
                   'featureType': 'arterial',
                   'elementType': 'geometry.fill',
                   'stylers': {
                     'color': '#000000'
                   }
                 },
                 {
                   'featureType': 'arterial',
                   'elementType': 'geometry.stroke',
                   'stylers': {
                     'color': '#0b3d51'
                   }
                 },
                 {
                   'featureType': 'local',
                   'elementType': 'geometry',
                   'stylers': {
                     'color': '#000000'
                   }
                 },
                 {
                   'featureType': 'railway',
                   'elementType': 'geometry.fill',
                   'stylers': {
                     'color': '#000000'
                   }
                 },
                 {
                   'featureType': 'railway',
                   'elementType': 'geometry.stroke',
                   'stylers': {
                     'color': '#08304b'
                   }
                 },
                 {
                   'featureType': 'subway',
                   'elementType': 'geometry',
                   'stylers': {
                     'lightness': -70
                   }
                 },
                 {
                   'featureType': 'building',
                   'elementType': 'geometry.fill',
                   'stylers': {
                     'color': '#000000'
                   }
                 },
                 {
                   'featureType': 'all',
                   'elementType': 'labels.text.fill',
                   'stylers': {
                     'color': '#857f7f'
                   }
                 },
                 {
                   'featureType': 'all',
                   'elementType': 'labels.text.stroke',
                   'stylers': {
                     'color': '#000000'
                   }
                 },
                 {
                   'featureType': 'building',
                   'elementType': 'geometry',
                   'stylers': {
                     'color': '#022338'
                   }
                 },
                 {
                   'featureType': 'green',
                   'elementType': 'geometry',
                   'stylers': {
                     'color': '#062032'
                     // 'visibility': 'off'
                   }
                 },
                 {
                   'featureType': 'boundary',
                   'elementType': 'all',
                   'stylers': {
                     'color': '#465b6c'
                   }
                 },
                 {
                   'featureType': 'manmade',
                   'elementType': 'all',
                   'stylers': {
                     'color': '#022338'
                   }
                 },
                 {
                   'featureType': 'label',
                   'elementType': 'all',
                   'stylers': {
                     // 'visibility': 'off'
                   }
                 },
                 {
                   'featureType': 'poi',
                   'elementType': 'all',
                   'stylers': {
                     'color': '#022338'
                     // 'visibility': 'off'
                   }
                 }
               ]
             }
           },
   
           series: [
             {
               name: '',
               type: 'scatter',
               coordinateSystem: 'bmap',
               // data: this.convertData(this.mapData),
               symbolSize: function(val) {
                 return val[2] / 10
               },
               label: {
                 normal: {
                   formatter: '{b}',
                   position: 'right',
                   show: false
                 },
                 emphasis: {
                   show: true
                 }
               },
               itemStyle: {
                 normal: {
                   color: 'purple'
                 }
               }
             },
             {
               name: '',
               type: 'effectScatter',
               coordinateSystem: 'bmap',
               data: this.convertData([{ 'name': '杭州' }]),
               symbolSize: function(val) {
                 return 20
               },
               showEffectOn: 'render',
               rippleEffect: {
                 brushType: 'stroke'
               },
               hoverAnimation: true,
               label: {
                 normal: {
                   formatter: '{b}',
                   position: 'right',
                   show: true
                 }
               },
               itemStyle: {
                 normal: {
                   color: '#50E3C2',
                   shadowBlur: 10,
                   shadowColor: '#333'
                 }
               },
               zlevel: 1
             }
           ]
         }
   
         this.myEacharts.setOption(option)
         var bmap = this.myEacharts.getModel().getComponent('bmap').getBMap()
       },
   
       click() {
         console.log('click click click')
         this.myEacharts.dispatchAction({
           type: 'showTip'
         })
       }
   `

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@echarts.apache.org
For additional commands, e-mail: dev-h...@echarts.apache.org

Reply via email to