如图,3D 地图是一个比较炫的组件,在这借官方示例「ECharts-GL Hello World」学习一下 3D 地图及飞线图的基本使用。
首先准备一个 3D 地球
option.globe= {
baseTexture: "./earth/world.topo.bathy.200401.jpg",
heightTexture: "./earth/world.topo.bathy.200401.jpg",
displacementScale: 0.04,
shading: 'realistic',
environment: './earth/starfield.jpg',
realisticMaterial: {
roughness: 0.9
},
postEffect: {
enable: true
},
light: {
main: {
intensity: 5,
shadow: true
},
ambientCubemap: {
texture: './earth/pisa.hdr',
diffuseIntensity: 0.2
}
}
}
加一点飞线
option.series = {
type: 'lines3D',
coordinateSystem: 'globe',
lineStyle: {
width: 1,
color: 'rgb(100, 100, 150)',
opacity: 0.8
},
blendMode: 'lighter',
data: [
[
[116, 40], // 起点的经纬度和海拔坐标
[0, 51] // 终点的经纬度和海拔坐标
],
...
]
};
后台回复「190523」获取示意代码,需要放到 IIS、TOMCAT 之类的 WEB 服务里使用,还需设置 .hdr 的 MIME 类型,如下图
本文分享自 ZXand618的ECharts之旅 微信公众号,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文参与 腾讯云自媒体分享计划 ,欢迎热爱写作的你一起参与!