echarts三维地图的实现


目标需要实现上图所示的新疆区域

1、首先需要下载echarts与echarts-gl依赖

npm install echarts --save
npm install echarts-gl -- save

2、相关vue文件中引入echarts与新疆省界的geojson

import * as echarts from 'echarts';
import xinjiang from "./xinjiang.json";

3、定义div

<div id="main"></div>

4、最终实现

var option =  {
    geo: [{
        map: 'JS',
        zlevel: 5,
        label: {
          show: true,
          textStyle: {
            color: '#eee',
            fontWeight: 'bold'
          }
        },
        itemStyle: {
          color: '#38BA99', // 背景
          borderWidth: '1', // 边框宽度
          borderColor: '#67EECE', // 边框颜色
        }
      },
      {
        map: 'JS',
        top: '12%',
        itemStyle: {
          color: '#28543E', // 背景
          borderColor: '#46D2AE', // 边框颜色
          shadowColor: '#679380',  // 外部阴影 
          shadowBlur: '65'
        }
    }
]
// 地图
let chart = echarts.init(document.getElementById('main'));
echarts.registerMap('JS', xinjiang);
chart.setOption(option);
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容