Skip to content

Commit 7fe9c69

Browse files
committed
refactor: 迁移分面图 demo 到高级图表下 & 增加公告
1 parent 3b84cfd commit 7fe9c69

18 files changed

+166
-10
lines changed

docs/manual/plots/facet.en.md

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: Facet
3+
order: 21
4+
contributors:
5+
[{ author: '新茗', github: 'visiky', avatar: 'https://gw.alipayobjects.com/zos/antfincdn/KAeYPA3TV0/avatar.jpeg' }]
6+
---
7+
8+
<!-- ### 用法建议 -->
9+
## Introduction
10+
11+
分面(Facet)是指利用 G2 提供的 View 递归嵌套能力,将一份数据按照某个维度分隔成若干子集,然后创建一个图表的集合,将每一个数据子集绘制到图表矩阵的窗格中。
12+
13+
分面主要提供了两个功能:
14+
15+
1. 按照指定的维度划分数据集;
16+
2. 对图表进行排版和布局。
17+
18+
对于探索型数据分析来说,分面是一个强大有力的工具,能帮我们快速地分析出数据各个子集模式的异同。目前 G2 内置的分面包括六种:rect、list、circle、tree、mirror 和 matrix,具体描述如下表所示:
19+
20+
| **分面类型** | **说明** |
21+
| :----------: | :---------------------------------------------------: |
22+
| rect | **默认类型**,指定 2 个维度作为行列,形成图表的矩阵。 |
23+
| list | 指定一个维度,可以指定一行有几列,超出自动换行。 |
24+
| circle | 指定一个维度,沿着圆分布。 |
25+
| tree | 指定多个维度,每个维度作为树的一级,展开多层图表。 |
26+
| mirror | 指定一个维度,形成镜像图表。 |
27+
| matrix | 指定一个维度,形成矩阵分面。 |
28+
29+
## Qucik start
30+
31+
<div class='sign'>
32+
33+
```ts
34+
import { Facet } from '@antv/g2plot';
35+
36+
fetch('https://gw.alipayobjects.com/os/antfincdn/VnrXpYSuqW/circle-pie.json')
37+
.then((res) => res.json())
38+
.then((data) => {
39+
const plot = new Facet('container', {
40+
type: 'circle',
41+
fields: ['clarity'],
42+
data,
43+
tooltip: { showMarkers: false },
44+
meta: {
45+
cut: {
46+
sync: true,
47+
},
48+
},
49+
eachView: (view, f) => {
50+
return {
51+
type: 'pie',
52+
options: {
53+
data: f.data,
54+
angleField: 'mean',
55+
colorField: 'cut',
56+
pieStyle: { stroke: null },
57+
},
58+
};
59+
},
60+
});
61+
plot.render();
62+
});
63+
64+
```
65+
66+
</div>
67+
68+
📊 See more <a href="/en/examples/plugin/facet#column" target='blank'>examples</a>.
69+
70+
🎨 For an overview of the gauge plot options see the [API reference](/en/docs/api/advanced-plots/facet).
71+
72+
</div>

docs/manual/plots/facet.zh.md

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: 分面图
3+
order: 21
4+
contributors:
5+
[{ author: '新茗', github: 'visiky', avatar: 'https://gw.alipayobjects.com/zos/antfincdn/KAeYPA3TV0/avatar.jpeg' }]
6+
---
7+
8+
<!-- ### 用法建议 -->
9+
## 介绍
10+
11+
分面(Facet)是指利用 G2 提供的 View 递归嵌套能力,将一份数据按照某个维度分隔成若干子集,然后创建一个图表的集合,将每一个数据子集绘制到图表矩阵的窗格中。
12+
13+
分面主要提供了两个功能:
14+
15+
1. 按照指定的维度划分数据集;
16+
2. 对图表进行排版和布局。
17+
18+
对于探索型数据分析来说,分面是一个强大有力的工具,能帮我们快速地分析出数据各个子集模式的异同。目前 G2 内置的分面包括六种:rect、list、circle、tree、mirror 和 matrix,具体描述如下表所示:
19+
20+
| **分面类型** | **说明** |
21+
| :----------: | :---------------------------------------------------: |
22+
| rect | **默认类型**,指定 2 个维度作为行列,形成图表的矩阵。 |
23+
| list | 指定一个维度,可以指定一行有几列,超出自动换行。 |
24+
| circle | 指定一个维度,沿着圆分布。 |
25+
| tree | 指定多个维度,每个维度作为树的一级,展开多层图表。 |
26+
| mirror | 指定一个维度,形成镜像图表。 |
27+
| matrix | 指定一个维度,形成矩阵分面。 |
28+
29+
## 快速开始
30+
31+
<div class='sign'>
32+
33+
```ts
34+
import { Facet } from '@antv/g2plot';
35+
36+
fetch('https://gw.alipayobjects.com/os/antfincdn/VnrXpYSuqW/circle-pie.json')
37+
.then((res) => res.json())
38+
.then((data) => {
39+
const plot = new Facet('container', {
40+
type: 'circle',
41+
fields: ['clarity'],
42+
data,
43+
tooltip: { showMarkers: false },
44+
meta: {
45+
cut: {
46+
sync: true,
47+
},
48+
},
49+
eachView: (view, f) => {
50+
return {
51+
type: 'pie',
52+
options: {
53+
data: f.data,
54+
angleField: 'mean',
55+
colorField: 'cut',
56+
pieStyle: { stroke: null },
57+
},
58+
};
59+
},
60+
});
61+
plot.render();
62+
});
63+
64+
```
65+
66+
</div>
67+
68+
📊 查看更多<a href="/zh/examples/plugin/facet#column" target='blank'>示例</a>.
69+
70+
🎨 柱状图详细的配置参考 [API 文档](/zh/docs/api/advanced-plots/facet).
71+
72+
</div>
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
title: Association Plots
3-
order: 3
3+
order: 4
44
---
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
title: 图表联动
3-
order: 3
3+
order: 4
44
---
File renamed without changes.
File renamed without changes.
File renamed without changes.

examples/facet/plot/demo/meta.json renamed to examples/plugin/facet/demo/meta.json

+16-8
Original file line numberDiff line numberDiff line change
@@ -10,63 +10,71 @@
1010
"zh": "Column 分面图",
1111
"en": "Column facet"
1212
},
13-
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/SAiAwUtFTN/d8350db2-a905-4bd0-9c99-a750a1ee8cb0.png"
13+
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/SAiAwUtFTN/d8350db2-a905-4bd0-9c99-a750a1ee8cb0.png",
14+
"new": true
1415
},
1516
{
1617
"filename": "rect.ts",
1718
"title": {
1819
"zh": "二维行列(矩形)分面",
1920
"en": "Rect facet"
2021
},
21-
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/%24PP5iO2j2X/3658552c-f0d2-4da5-a236-36509187676c.png"
22+
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/%24PP5iO2j2X/3658552c-f0d2-4da5-a236-36509187676c.png",
23+
"new": true
2224
},
2325
{
2426
"filename": "list.ts",
2527
"title": {
2628
"zh": "列表分面",
2729
"en": "List facet"
2830
},
29-
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/8cbQnUoZKq/1e19cd37-55b7-4c56-8476-a64aa5bdb768.png"
31+
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/8cbQnUoZKq/1e19cd37-55b7-4c56-8476-a64aa5bdb768.png",
32+
"new": true
3033
},
3134
{
3235
"filename": "circle.ts",
3336
"title": {
3437
"zh": "圆形分面",
3538
"en": "Circle facet"
3639
},
37-
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/PaADJJDV4V/1f52ab89-c989-4014-bd18-c3f3d36f8a90.png"
40+
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/PaADJJDV4V/1f52ab89-c989-4014-bd18-c3f3d36f8a90.png",
41+
"new": true
3842
},
3943
{
4044
"filename": "mirror.ts",
4145
"title": {
4246
"zh": "镜像分面",
4347
"en": "Mirror facet"
4448
},
45-
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/lt6RMVMz7I/0623b932-a8dc-402f-87d3-a80d889661bf.png"
49+
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/lt6RMVMz7I/0623b932-a8dc-402f-87d3-a80d889661bf.png",
50+
"new": true
4651
},
4752
{
4853
"filename": "matrix.ts",
4954
"title": {
5055
"zh": "矩阵分面",
5156
"en": "Matrix facet"
5257
},
53-
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/tx5DXB6xhh/99a19fdb-c428-43a2-8210-49e255d14e8c.png"
58+
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/tx5DXB6xhh/99a19fdb-c428-43a2-8210-49e255d14e8c.png",
59+
"new": true
5460
},
5561
{
5662
"filename": "tree.ts",
5763
"title": {
5864
"zh": "树型分面",
5965
"en": "Tree facet"
6066
},
61-
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/Hq%24sncegPI/3620662f-48f8-45c6-a269-c36168137ea0.png"
67+
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/Hq%24sncegPI/3620662f-48f8-45c6-a269-c36168137ea0.png",
68+
"new": true
6269
},
6370
{
6471
"filename": "tree-column.ts",
6572
"title": {
6673
"zh": "多级树型分面",
6774
"en": "Tree clolumn facet"
6875
},
69-
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/CBR0Ay1K3M/44c5908a-9a23-4aa0-8e26-563619456997.png"
76+
"screenshot": "https://gw.alipayobjects.com/zos/antfincdn/CBR0Ay1K3M/44c5908a-9a23-4aa0-8e26-563619456997.png",
77+
"new": true
7078
}
7179
]
7280
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

gatsby-config.js

+4
Original file line numberDiff line numberDiff line change
@@ -307,5 +307,9 @@ module.exports = {
307307
apiKey: '0d19588d7661a81faa8b75f6ade80321',
308308
indexName: 'antv_g2plot',
309309
},
310+
announcement: {
311+
zh: '1. 上新图表啦!请前往「教程 - 图表指引」查看「分面图」介绍。2. 另外,关于「股票图」、「图表组件:Tooltip」相关文档更新,请前往「API 文档」进行查看。',
312+
en: '1. 上新图表啦!请前往「教程 - 图表指引」查看「分面图」介绍。2. 另外,关于「股票图」、「图表组件:Tooltip」相关文档更新,请前往「API 文档」进行查看。',
313+
}
310314
},
311315
};

0 commit comments

Comments
 (0)