前端札记 前端札记
首页
    • 前端
    • 服务器
    • 其他
  • 分类
  • 归档
  • 标签
GitHub (opens new window)

Xin

面朝大海,春暖花开
首页
    • 前端
    • 服务器
    • 其他
  • 分类
  • 归档
  • 标签
GitHub (opens new window)
  • 折线、柱状图

  • 饼图

  • 地图

    • 地图2D
    • 地图3D
  • 《Echarts》笔记
  • 地图
Xin
2024-07-17

地图2D

<template>
  <div ref="henan_map" style="width: 100%; height: 83vh" />
</template>

<script>
export default {
  data() {
    return {
      henanJson: require('/docs/.vuepress/utils/河南省.json'),
    };
  },
  mounted() {
    this.initChart();
  },
  methods: {
    initChart() {
      const chart = echarts.init(this.$refs.henan_map);
      echarts.registerMap('henan', this.henanJson);

      let option = {
        tooltip: {
          trigger: 'item',
        },
        legend: {
          orient: 'horizontal',
          left: 'right',
          top: 'top',
        },
        geo: {
          map: 'henan',
          emphasis: {
            label: {
              show: true,
              textStyle: {
                show: true,
                fontWeight: 'bold',
                fontSize: 18,
                color: 'red',
              },
            },
            itemStyle: {
              areaColor: 'rgba(246,227,17,0.1)',
              borderColor: '#CCC',
            },
          },
          label: {
            show: true,
            textStyle: {
              color: '#000',
              fontWeight: 'bold',
              fontSize: 18,
            },
          },
          itemStyle: {
            areaColor: 'rgba(235,245,255,0.5)',
            borderColor: '#CCC',
          },
        },
        series: [],
      };
      chart.setOption(option, true);
    },
  },
};
</script>
<style lang="scss" scoped></style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
显示代码 复制代码 复制代码
编辑 (opens new window)
#Echarts
上次更新: 2024-07-17 17:07:35
双环饼图
地图3D

← 双环饼图 地图3D→

Theme by Vdoing | Copyright © 2021-2025
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式