雷达图
点图层还支持一种特殊的图层类型:雷达图。
实现
下面我们来介绍如何绘制一个常见的雷达图。
- 你可以在
L7官网上找到在线案例
import { Scene, PointLayer } from '@antv/l7';
import { GaodeMap } from '@antv/l7-maps';
const scene = new Scene({
id: 'map',
map: new GaodeMap({
center: [120, 30],
zoom: 13,
}),
});
const layer = new PointLayer()
.source([{ lng: 120, lat: 30 }], {
parser: {
type: 'json',
x: 'lng',
y: 'lat',
},
})
.shape('radar')
.size(100)
.color('#d00')
.style({
speed: 5,
})
.animate(true);
source
雷达图接受普通的点数据。
shape
雷达图的 shape 为固定值 radar。
animate
雷达图需要将 animate 设置为 true 才会生效
.animate(true)
.animate({
enable: true
})
style
通过 speed 设置旋转速度,默认为 1,值越大转速越快。