要在地球视角下画出海运路线图
方案
- 添加 globl 地球
- 创建geo地理坐标系
- 创建canvas对象用于承载地图世界地图this.worldChart
let cav = document.createElement("canvas");
this.$echarts.registerMap("world", geoJson);
this.worldChart = this.$echarts.init(cav, null, {
width: 4096,
height: 2048,
});
this.worldChart.setOption(this.worldChartOption);
- 设置globl 的baseTexture为this.worldChart
- 添加lines3D飞线效果
上组件源码
<template>
<div>
<div id="box" @click="showAll"></div>
</div>
</template>
<script>
import geoJson from "./mapJson.js";
import {
nameMap, startPoint, changKu, chuan, gongChang } from "./data.js";
import {
points, line } from "./lines.js";
export default {
data() {
return {
worldChart: null,
worldChartOption: {
backgroundColor: "rgba(3,28,72,1)",
geo: {
type: "map",
map: "world",
nameMap: nameMap,
left: 0,
top: 0,
right: 0,
bottom: 0,
boundingCoords: [
[-180, 90],
[180, -90],
],
zoom: 0,
roam: true,
itemStyle: {
areaColor: "#174f87",
color: "#fff",
borderColor: "#2578cb",
opacity: 0.9,
},
emphasis: {
itemStyle: {
areaColor: "#31deff",
color: "#174f87",
borderColor: "#318ED2",
borderWidth: 2,
shadowColor: "#15629A",
shadowBlur: 1,
shadowOffsetX: 3,
shadowOffsetY: 5,
},
},
label: {
fontSize: 28,
},
},
series: [],
},
globleChart: null,
globleChartOption: {
globe: {
show: true,
globeRadius: 120,
globeOu