facetCircle
上一篇
概览
下一篇
facetRect
Loading...
根据字段分片数据,利用圆形划分空间,然后进行各个分面的数据可视化。
import { Chart } from '@antv/g2';const M = ['Jan.','Feb.','Mar.','Apr.','May','Jun.','Jul.','Aug.','Sept.','Oct.','Nov.','Dec.',];const N = ['A', 'B', 'C', 'D'];const data = M.flatMap((month) =>N.map((name) => ({month,name,value: Math.random(),})),);const chart = new Chart({container: 'container',width: 480,height: 480,});chart.options({type: 'facetCircle',data,encode: { position: 'month' },children: [{type: 'interval',encode: { x: 'name', y: 'value', color: 'name' },},],});chart.render();
更多的案例,可以查看图表示例页面。
facetCircle 的底层实现和 mark 一致,所以在配置上有很多是一样的。
facetCircle 对应的配置都可以使用 API 进行设置,例如:
chart.options({ type: 'facetCircle', data: [1, 2, 3], encode: { position: 'month' } });
对于 facetCircle 有自己独特的 encode 通道。
| 通道 | 描述 | 类型 | 默认值 |
|---|---|---|---|
| position | 按照 position 对应的数据去划分圆形空间中的角度 | string | (d, idx, arr) => any |