vue echarts geo地图
时间: 2023-11-14 22:04:49 浏览: 174
好的,关于 vue echarts geo 地图,你需要先安装 echarts 和 echarts-gl,然后在组件中引入 echarts 和 echarts-gl,再使用 geo 组件来绘制地图。具体步骤如下:
- 安装 echarts 和 echarts-gl:
npm install echarts echarts-gl --save
- 在组件中引入 echarts 和 echarts-gl:
import echarts from 'echarts'
import 'echarts-gl'
- 在组件中使用 geo 组件来绘制地图:
<template>
<div ref="chart" style="width: 100%; height: 100%;"></div>
</template>
<script>
export default {
mounted() {
const chart = echarts.init(this.$refs.chart)
chart.setOption({
geo: {
map: 'world'
},
series: [{
type: 'scatterGL',
coordinateSystem: 'geo',
data: [[-73.935242, 40.73061]],
symbolSize: 10,
itemStyle: {
color: '#F00'
}
}]
})
}
}
</script>
这里的例子是在地图上添加了一个红色的点,你可以根据自己的需求来修改。
相关推荐


















