echart 地图,怎么通过单独配置标注出钓鱼岛

echart 地图,怎么通过单独配置标注出钓鱼岛

  const option = {
        geo: {
          // show: true,
          // map: mapName,
          // aspectScale: 0.85,
          // layoutCenter: ["50%", "50%"], //地图位置
          // layoutSize: '100%',
          // itemStyle: {
          //   normal: {
          //     shadowColor: "#000",
          //     shadowOffsetX: 0,
          //     shadowOffsetY: 5,
          //     opacity: 0.5,
          //   },
          //   emphasis: {
          //     areaColor: "#f80", // rgba(4, 188, 249, 1)
          //   }
          // },
          regions: [

            {
              name: "台湾省",
              itemStyle: {
                  normal: { opacity: 1, label: { show: true } }
                }
            }

          ],

        },
        visualMap: {
          type: "piecewise",
          show: true,
          min: 0,
          max: maxData,
          left: '10%',
          top: 'bottom',
          calculable: true,
          seriesIndex: [0],
          text: ['高', '低'],

          inRange: {
            color: ['#D8E5FB', '#005AFF']
          }
        },

        series: [

          {
            type: 'map',
            map: mapName,
            // aspectScale: 0.85,
            layoutCenter: ["50%", "70%"], //地图位置
            layoutSize: '100%',
            zoom: 1.4, //当前视角的缩放比例
            // roam: true, //是否开启平游或缩放
            scaleLimit: { //滚轮缩放的极限控制
              min: 1,
              max: 2
            },
            itemStyle: {
              normal: {
                areaColor: '#D8E5FB',
                borderColor: '#fdfdfd',
                borderWidth: 1.5

              },
              emphasis: {
                areaColor: 'rgba(4, 188, 249, 1)',
                label: {
                  color: "#fafafa"
                }

              }
            },



            data: [
              // {
              //   name: "南海诸岛", value: 0,
              //   itemStyle: {
              //     normal: { opacity: 1, label: { show: false } }
              //   }
              // },
              ...data
            ]
          },
        ]

      };
      this.chart.setOption(option, false);
阅读 4.8k
1 个回答

在series里增加:

'series':[
  {...},
  {
    type:'scatter',
    name:'快看我',
    coordinateSystem:'geo',
    data:[
      {
        name:'钓鱼岛',
        value:[经度,纬度,'是中国的']
      }
    ]
  }
]