惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Engineering at Meta
Engineering at Meta
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Martin Fowler
Martin Fowler
雷峰网
雷峰网
Recent Announcements
Recent Announcements
博客园 - 叶小钗
F
Full Disclosure
C
Check Point Blog
A
About on SuperTechFans
L
LangChain Blog
Vercel News
Vercel News
T
The Blog of Author Tim Ferriss
博客园 - 司徒正美
C
Cybersecurity and Infrastructure Security Agency CISA
C
CXSECURITY Database RSS Feed - CXSecurity.com
Cisco Talos Blog
Cisco Talos Blog
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
MongoDB | Blog
MongoDB | Blog
Project Zero
Project Zero
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Know Your Adversary
Know Your Adversary
D
Docker
U
Unit 42
酷 壳 – CoolShell
酷 壳 – CoolShell
T
The Exploit Database - CXSecurity.com
L
Lohrmann on Cybersecurity
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Latest news
Latest news
V
Visual Studio Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LINUX DO - 最新话题
Google DeepMind News
Google DeepMind News
小众软件
小众软件
NISL@THU
NISL@THU
GbyAI
GbyAI
H
Heimdal Security Blog
Jina AI
Jina AI
I
InfoQ
PCI Perspectives
PCI Perspectives
P
Privacy International News Feed
P
Proofpoint News Feed
N
News and Events Feed by Topic
C
CERT Recently Published Vulnerability Notes
aimingoo的专栏
aimingoo的专栏
SecWiki News
SecWiki News
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志

博客园 - ^Mao^

不同缩放下适配 vxe-table 3D饼图 openlayer实现给线的附近添加点,点支持移动 element-plus el-select html导出pdf openlayers增加移动功能 适配 部分页面统计用户访问时长 openlayers基本使用(街景+标注+绘制) 使用openlayer绘制街景地图 正则表达式--取对应表达式的值 vue2实现el-table-column多级效果 echarts-雷达图 echarts--地图 散点图效果 echarts散点图区域设置 vant 的vant-uploader组件问题 Threejs学习 test
Echarts-普通地图和3D地图实现
^Mao^ · 2025-03-21 · via 博客园 - ^Mao^

效果图

实现代码

<template>
  <div class="app">
    <h1>普通地图----------------</h1>
    <div class="map-container" ref="map_ref"></div>
    <h1>3D地图----------------</h1>
    <div class="map-container" ref="map_ref_2"></div>
  </div>
</template>

<script>
import * as echarts from 'echarts'
import 'echarts-gl'
// 1. 引入china国家的json数据
// import * as geojson from 'world-geojson'
// const china_json = geojson.forCountry('china')
import china_json from './config/china.json'
echarts.registerMap('china', china_json)

export default {
  data() {
    return {
      chart_instance: null,
      chart_instance_2: null,
    }
  },
  mounted() {
    this.initMap()
    this.initMap2()
  },
  methods: {
    initMap() {
      const chart_instance = echarts.init(this.$refs.map_ref)
      var option = {
        series: [
          {
            type: 'map',
            map: 'china',
            label: {
              show: true,
              color: '#000', //地图初始化区域字体颜色
              fontSize: 10,
              formatter: function (params) {
                if (params.name == '黑龙江省') return params.name
                return ''
              },
            },
            itemStyle: {
              // 未选择区域的样式
              normal: {
                areaColor: '#eeeeee',
                color: 'white',
                borderColor: 'gray',
                borderWidth: 1,
              },
              emphasis: {
                // 选择区域的样式
                areaColor: '#ffdf33',
              },
            },
            data: [
              {
                name: '广东省', //这个对应的是json的数据
                selected: true, // 将该区域设置为默认高亮
              },
            ],
          },
        ],
      }
      chart_instance.setOption(option)
      this.chart_instance = chart_instance
    },
    initMap2() {
      const chart_instance = echarts.init(this.$refs.map_ref_2)
      var option = {
        geo3D: {
          map: 'china', //注册地图的名字
          roam: true, //开启鼠标缩放和平移漫游。默认不开启
          itemStyle: {
            color: '#eee', // 背景

            opacity: 1, //透明度
            borderWidth: 1, // 边框宽度
            borderColor: 'gray', // 边框颜色
            fontSize: 10, //
          },
          emphasis: {
            itemStyle: {
              color: '#ffdf33',
            },
          },
          label: {
            show: true,
          },
          viewControl: {
            distance: 100,
            alpha: 45, // 上下旋转的角度
            beta: 0, // 左右旋转的角度
          },
          regions: [
            {
              name: '广东省',
              itemStyle: {
                color: '#f00',
              },
            },
          ],
        },
      }
      chart_instance.setOption(option)
      this.chart_instance_2 = chart_instance
    },
  },
}
</script>

<style lang="less" scoped>
.map-container {
  height: 600px;
  border: 1px solid;
}
</style>

参考文档