antvis/G2






The issue has been closed
改变 Spec 数组字段的 API 配置方式 #4599
pearmini posted onGitHub
数组字段 API 修改
在 G2 5.0 的 Spec 中,有一些字段是数组,比如 transform。
const options = {
transform: [{ type: 'stackY', orderBy: 'value' }, { type: 'normalizeY' }],
}
目前 Chart API 的配置方式如下:
interval
.transform({ type: 'stackY' })
.transform({ type: 'normalizeY' })
为了让 API 之间保持更加统一,也和 4.0 更加兼容,修改 API 的形式如下:
interval
.transform('stackY', { orderBy: 'value' })
.transform('normalizeY')
API 设计
# mark.[arrayField](type, [_options_])
arrayField 枚举值如下:
- transform
- coordinate
- interaction
其中 type 是必须参数,指定该可视化组件的类型。options 是可选参数,指定改可视化组件的配置。
思路
修改 src/api/props.ts
里面的 defineArrayProp
函数。
TODO
- 代码:transform,coordinate,interaction
- 测试:单元测试
- 案例
- 文档