2020-08-10 10:44:28 +08:00
|
|
|
---
|
|
|
|
title: 气泡图
|
|
|
|
order: 1
|
|
|
|
---
|
2021-12-29 17:08:46 +08:00
|
|
|
|
2020-11-21 03:51:18 +08:00
|
|
|
`markdown:docs/common/style.md`
|
2020-08-10 10:44:28 +08:00
|
|
|
气泡图地理区域上方会显示不同大小的圆点,圆形面积与其在数据集中的数值会成正比。
|
|
|
|
|
2020-11-16 15:19:41 +08:00
|
|
|
## 基础使用
|
2020-08-10 10:44:28 +08:00
|
|
|
|
2020-08-20 17:09:45 +08:00
|
|
|
气泡图通过 PointLayer 对象实例化,
|
2020-08-10 10:44:28 +08:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
import { PointLayer } from '@antv/l7';
|
|
|
|
```
|
2020-08-20 17:09:45 +08:00
|
|
|
|
|
|
|
### shape
|
|
|
|
|
|
|
|
通常气泡图 shape 设置为 **circle**
|
2020-08-10 10:44:28 +08:00
|
|
|
|
|
|
|
### size
|
|
|
|
|
|
|
|
气泡图大小,需要指定数据映射字段
|
|
|
|
|
|
|
|
```javascript
|
2020-08-20 17:09:45 +08:00
|
|
|
const bubble = new PointLayer()
|
|
|
|
.source(data)
|
|
|
|
.shape(circle)
|
|
|
|
.size('mag', [0, 25])
|
|
|
|
.color('red')
|
|
|
|
.style({
|
|
|
|
opacity: 0.3,
|
|
|
|
strokeWidth: 1,
|
|
|
|
});
|
2020-08-10 10:44:28 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
### animate
|
|
|
|
|
|
|
|
气泡图支持水波动画效果
|
|
|
|
|
|
|
|
#### 开启关闭动画
|
|
|
|
|
|
|
|
```javascript
|
2020-08-20 17:09:45 +08:00
|
|
|
layer.animate(true);
|
|
|
|
layer.animate(false);
|
2020-08-10 10:44:28 +08:00
|
|
|
```
|
2020-08-20 17:09:45 +08:00
|
|
|
|
2020-08-10 10:44:28 +08:00
|
|
|
#### 水波配置项
|
|
|
|
|
|
|
|
- speed 水波速度
|
|
|
|
- rings 水波环数
|
|
|
|
|
|
|
|
## tips
|
|
|
|
|
2020-08-20 17:09:45 +08:00
|
|
|
目前 style 的配置项只支持全局设置,不支持数据映射。
|
2020-08-10 10:44:28 +08:00
|
|
|
|
|
|
|
如果 opacity 设置为 0.3 则所有的气泡都是 0.3
|
|
|
|
|
2020-08-20 17:09:45 +08:00
|
|
|
style 方法如果没有设置 stroke, 默认于气泡的填充色相同
|
2020-11-16 15:19:41 +08:00
|
|
|
|
|
|
|
`markdown:docs/common/layer/base.md`
|