vue echarts 广州3d地图
时间: 2023-12-09 22:36:45 浏览: 190
以下是使用Vue和Echarts实现广州3D地图的步骤:
1.首先,安装Echarts和Echarts-GL:
```shell
npm install echarts echarts-gl --save
```
2.在Vue组件中引入Echarts和Echarts-GL:
```javascript
import * as echarts from 'echarts';
import 'echarts-gl';
```
3.下载中国地图数据,存储到本地路径下。可以从Echarts官网下载,也可以使用以下命令从GitHub上下载:
```shell
git clone https://github.com/echarts-maps/echarts-china-provinces-js.git
```
4.在Vue组件中使用Echarts绘制3D地图:
```html
<template>
<div id="chart" style="width: 100%; height: 100%;"></div>
</template>
<script>
export default {
mounted() {
const chartDom = document.getElementById('chart');
const myChart = echarts.init(chartDom);
const option = {
geo3D: {
map: '广州',
roam: true,
itemStyle: {
color: '#1d5e98',
opacity: 1,
borderWidth: 0.4,
borderColor: '#000',
},
label: {
show: true,
textStyle: {
color: '#fff',
fontSize: 16,
fontWeight: 'bold',
},
},
emphasis: {
label: {
show: true,
textStyle: {
color: '#fff',
fontSize: 16,
fontWeight: 'bold',
},
},
itemStyle: {
color: '#f00',
},
},
shading: 'lambert',
light: {
main: {
intensity: 1.2,
shadow: true,
alpha: 55,
},
ambient: {
intensity: 0.3,
},
},
},
series: [],
};
myChart.setOption(option);
},
};
</script>
```
5.运行Vue应用程序并查看3D地图。
阅读全文
相关推荐


















