Vue uses Echarts to display incomplete maps.

simplify the official website demo, and as a result, the map only shows the South China Sea islands and each point.

clipboard.png

official website Demo

the Vue code is as follows:

drawMap () {
  let data = [
    {name: "", value: 9},
    {name: "", value: 12},
    {name: "", value: 12},
    {name: "", value: 12},
    {name: "", value: 14},
    {name: "", value: 15},
    {name: "", value: 16},
    {name: "", value: 18},
    {name: "", value: 18},
    {name: "", value: 19},
    {name: "", value: 21}
  ]
  let geoCoordMap = {
    "": [121.15, 31.89],
    "": [109.781327, 39.608266],
    "": [120.38, 37.35],
    "": [122.207216, 29.985295],
    "": [123.97, 47.33],
    "": [120.13, 33.38],
    "": [118.87, 42.28],
    "": [120.33, 36.07],
    "": [121.52, 36.89],
    "": [102.188043, 38.520089],
    "": [118.58, 24.93]
  }
  let convertData = function (data) {
    var res = []
    for (var i = 0; i < data.length; iPP) {
      var geoCoord = geoCoordMap[data[i].name]
      if (geoCoord) {
        res.push({
          name: data[i].name,
          value: geoCoord.concat(data[i].value)
        })
      }
    }
    return res
  }
  let option = {
    tooltip: {
      trigger: "item",
      formatter: function (params) {
        return params.name + " : " + params.value[2]
      }
    },
    geo: {
      map: "china",
      roam: true,
      label: {
        emphasis: {
          show: false
        }
      },
      itemStyle: {
        normal: {
          areaColor: "-sharpa19cef",
          borderColor: "-sharpc4c2f5"
        },
        emphasis: {
          areaColor: "-sharp8c86f7"
        }
      }
    },
    series: [
      {
        name: "house",
        type: "scatter",
        coordinateSystem: "geo",
        data: convertData(data),
        symbolSize: 20,
        label: {
          normal: {
            show: false
          },
          emphasis: {
            show: false
          }
        },
        itemStyle: {
          normal: {
            color: "-sharpf1f425"
          },
          emphasis: {
            borderColor: "-sharpfff",
            borderWidth: 1
          }
        }
      }
    ]

  }
  this.chartMap = echarts.init(document.getElementById("chartMap"))
  this.chartMap.setOption(option)
}

call this.drawMap () in mounted

I don"t know what the problem is. Try it with the Echart3 version, the same question

Mar.04,2021

it is estimated that there is no registered map file. The map file is under echarts/map , with json and js formats, introduced and registered. Take World Map as an example:

import echarts from 'echarts'
import world from 'echarts/map/json/world.json'

echarts.registerMap('world', world)

you don't have a map file, do you

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c296af-3397e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c296af-3397e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?