@antv/g2 5.0.0-alpha.4 → 5.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -27
- package/dist/g2-lite.min.js +2 -2
- package/dist/g2.min.js +2 -2
- package/esm/animation/morphing.js +10 -8
- package/esm/animation/morphing.js.map +1 -1
- package/esm/api/chart.js +2 -5
- package/esm/api/chart.js.map +1 -1
- package/esm/component/axis.d.ts +1 -2
- package/esm/component/axis.js +81 -198
- package/esm/component/axis.js.map +1 -1
- package/esm/component/legendCategory.d.ts +0 -1
- package/esm/component/legendCategory.js +36 -49
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/component/legendContinuous.js +29 -19
- package/esm/component/legendContinuous.js.map +1 -1
- package/esm/component/utils.d.ts +1 -0
- package/esm/component/utils.js +3 -0
- package/esm/component/utils.js.map +1 -1
- package/esm/composition/facetRect.js +2 -4
- package/esm/composition/facetRect.js.map +1 -1
- package/esm/composition/repeatMatrix.js +2 -2
- package/esm/composition/repeatMatrix.js.map +1 -1
- package/esm/interaction/action/service/legendItemSelection.js.map +1 -1
- package/esm/interaction/action/transformer/setItemState.js.map +1 -1
- package/esm/mark/cell.js +1 -1
- package/esm/mark/pack.js +2 -2
- package/esm/mark/pack.js.map +1 -1
- package/esm/mark/sankey.js +1 -0
- package/esm/mark/sankey.js.map +1 -1
- package/esm/mark/treemap.js +2 -2
- package/esm/mark/treemap.js.map +1 -1
- package/esm/mark/wordCloud.js +2 -2
- package/esm/mark/wordCloud.js.map +1 -1
- package/esm/shape/area/curve.js +2 -9
- package/esm/shape/area/curve.js.map +1 -1
- package/esm/shape/interval/color.js +2 -2
- package/esm/shape/interval/color.js.map +1 -1
- package/esm/shape/line/curve.js +23 -12
- package/esm/shape/line/curve.js.map +1 -1
- package/esm/shape/line/line.js +6 -2
- package/esm/shape/line/line.js.map +1 -1
- package/esm/shape/line/smooth.js +6 -2
- package/esm/shape/line/smooth.js.map +1 -1
- package/esm/shape/text/advance.js +2 -2
- package/esm/shape/text/advance.js.map +1 -1
- package/esm/shape/utils.d.ts +1 -0
- package/esm/shape/utils.js +8 -1
- package/esm/shape/utils.js.map +1 -1
- package/esm/spec/geometry.d.ts +2 -2
- package/esm/spec/transform.d.ts +10 -2
- package/esm/stdlib/index.js +2 -2
- package/esm/stdlib/index.js.map +1 -1
- package/esm/theme/dark.js +78 -65
- package/esm/theme/dark.js.map +1 -1
- package/esm/theme/light.js +84 -74
- package/esm/theme/light.js.map +1 -1
- package/esm/transform/groupN.js +2 -0
- package/esm/transform/groupN.js.map +1 -1
- package/esm/transform/index.d.ts +8 -6
- package/esm/transform/index.js +4 -3
- package/esm/transform/index.js.map +1 -1
- package/esm/transform/sample.d.ts +8 -0
- package/esm/transform/sample.js +48 -0
- package/esm/transform/sample.js.map +1 -0
- package/esm/transform/{Select.d.ts → select.d.ts} +0 -0
- package/esm/transform/{Select.js → select.js} +1 -1
- package/esm/transform/{Select.js.map → select.js.map} +1 -1
- package/esm/transform/{SelectX.d.ts → selectX.d.ts} +0 -0
- package/esm/transform/{SelectX.js → selectX.js} +1 -1
- package/esm/transform/{SelectX.js.map → selectX.js.map} +1 -1
- package/esm/transform/{SelectY.d.ts → selectY.d.ts} +0 -0
- package/esm/transform/{SelectY.js → selectY.js} +1 -1
- package/esm/transform/{SelectY.js.map → selectY.js.map} +1 -1
- package/esm/transform/sort.d.ts +1 -1
- package/esm/transform/sort.js +39 -21
- package/esm/transform/sort.js.map +1 -1
- package/lib/animation/morphing.js +10 -8
- package/lib/animation/morphing.js.map +1 -1
- package/lib/api/chart.js +2 -5
- package/lib/api/chart.js.map +1 -1
- package/lib/component/axis.d.ts +1 -2
- package/lib/component/axis.js +80 -197
- package/lib/component/axis.js.map +1 -1
- package/lib/component/legendCategory.d.ts +0 -1
- package/lib/component/legendCategory.js +36 -49
- package/lib/component/legendCategory.js.map +1 -1
- package/lib/component/legendContinuous.js +29 -19
- package/lib/component/legendContinuous.js.map +1 -1
- package/lib/component/utils.d.ts +1 -0
- package/lib/component/utils.js +5 -1
- package/lib/component/utils.js.map +1 -1
- package/lib/composition/facetRect.js +2 -4
- package/lib/composition/facetRect.js.map +1 -1
- package/lib/composition/repeatMatrix.js +2 -2
- package/lib/composition/repeatMatrix.js.map +1 -1
- package/lib/interaction/action/service/legendItemSelection.js.map +1 -1
- package/lib/interaction/action/transformer/setItemState.js.map +1 -1
- package/lib/mark/cell.js +1 -1
- package/lib/mark/pack.js +2 -2
- package/lib/mark/pack.js.map +1 -1
- package/lib/mark/sankey.js +1 -0
- package/lib/mark/sankey.js.map +1 -1
- package/lib/mark/treemap.js +2 -2
- package/lib/mark/treemap.js.map +1 -1
- package/lib/mark/wordCloud.js +2 -2
- package/lib/mark/wordCloud.js.map +1 -1
- package/lib/shape/area/curve.js +2 -9
- package/lib/shape/area/curve.js.map +1 -1
- package/lib/shape/interval/color.js +2 -2
- package/lib/shape/interval/color.js.map +1 -1
- package/lib/shape/line/curve.js +21 -10
- package/lib/shape/line/curve.js.map +1 -1
- package/lib/shape/line/line.js +5 -1
- package/lib/shape/line/line.js.map +1 -1
- package/lib/shape/line/smooth.js +5 -1
- package/lib/shape/line/smooth.js.map +1 -1
- package/lib/shape/text/advance.js +2 -2
- package/lib/shape/text/advance.js.map +1 -1
- package/lib/shape/utils.d.ts +1 -0
- package/lib/shape/utils.js +9 -1
- package/lib/shape/utils.js.map +1 -1
- package/lib/spec/geometry.d.ts +2 -2
- package/lib/spec/transform.d.ts +10 -2
- package/lib/stdlib/index.js +1 -1
- package/lib/stdlib/index.js.map +1 -1
- package/lib/theme/dark.js +78 -65
- package/lib/theme/dark.js.map +1 -1
- package/lib/theme/light.js +84 -74
- package/lib/theme/light.js.map +1 -1
- package/lib/transform/groupN.js +2 -0
- package/lib/transform/groupN.js.map +1 -1
- package/lib/transform/index.d.ts +8 -6
- package/lib/transform/index.js +9 -7
- package/lib/transform/index.js.map +1 -1
- package/lib/transform/sample.d.ts +8 -0
- package/lib/transform/sample.js +52 -0
- package/lib/transform/sample.js.map +1 -0
- package/lib/transform/{Select.d.ts → select.d.ts} +0 -0
- package/lib/transform/{Select.js → select.js} +1 -1
- package/lib/transform/{Select.js.map → select.js.map} +1 -1
- package/lib/transform/{SelectX.d.ts → selectX.d.ts} +0 -0
- package/lib/transform/{SelectX.js → selectX.js} +1 -1
- package/lib/transform/{SelectX.js.map → selectX.js.map} +1 -1
- package/lib/transform/{SelectY.d.ts → selectY.d.ts} +0 -0
- package/lib/transform/{SelectY.js → selectY.js} +1 -1
- package/lib/transform/{SelectY.js.map → selectY.js.map} +1 -1
- package/lib/transform/sort.d.ts +1 -1
- package/lib/transform/sort.js +38 -20
- package/lib/transform/sort.js.map +1 -1
- package/package.json +3 -3
- package/src/animation/morphing.ts +12 -8
- package/src/api/chart.ts +2 -5
- package/src/component/axis.ts +233 -310
- package/src/component/legendCategory.ts +52 -68
- package/src/component/legendContinuous.ts +24 -25
- package/src/component/utils.ts +4 -0
- package/src/composition/facetRect.ts +2 -4
- package/src/composition/repeatMatrix.ts +2 -2
- package/src/interaction/action/service/legendItemSelection.ts +1 -2
- package/src/interaction/action/transformer/setItemState.ts +2 -3
- package/src/mark/cell.ts +1 -1
- package/src/mark/pack.ts +1 -0
- package/src/mark/sankey.ts +1 -0
- package/src/mark/treemap.ts +1 -0
- package/src/mark/wordCloud.ts +1 -0
- package/src/shape/area/curve.ts +7 -9
- package/src/shape/interval/color.ts +7 -7
- package/src/shape/line/curve.ts +27 -12
- package/src/shape/line/line.ts +6 -2
- package/src/shape/line/smooth.ts +11 -2
- package/src/shape/text/advance.ts +2 -2
- package/src/shape/utils.ts +8 -1
- package/src/spec/geometry.ts +2 -1
- package/src/spec/transform.ts +10 -1
- package/src/stdlib/index.ts +2 -0
- package/src/theme/dark.ts +78 -66
- package/src/theme/light.ts +84 -75
- package/src/transform/groupN.ts +2 -0
- package/src/transform/index.ts +8 -6
- package/src/transform/sample.ts +45 -0
- package/src/transform/sort.ts +53 -21
package/README.md
CHANGED
|
@@ -6,7 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
<div align="center">
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
简洁的渐进式可视化语法
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://g2.antv.antgroup.com/manual/introduction">介绍</a> •
|
|
13
|
+
<a href="https://g2.antv.antgroup.com/examples">案例</a> •
|
|
14
|
+
<a href="https://g2.antv.antgroup.com/manual/getting-started">教程</a> •
|
|
15
|
+
<a href="https://g2.antv.antgroup.com/api/overview">API</a>
|
|
16
|
+
</p>
|
|
10
17
|
|
|
11
18
|
[](https://github.com/antvis//actions)
|
|
12
19
|
[](https://coveralls.io/github/antvis/g2?branch=v5)
|
|
@@ -14,49 +21,44 @@ G2 是一个可视化语法,用于报表搭建、数据探索和可视化叙
|
|
|
14
21
|
[](https://www.npmjs.com/package/@antv/g2)
|
|
15
22
|
[](https://www.npmjs.com/package/@antv/g2)
|
|
16
23
|
|
|
17
|
-

|
|
18
25
|
|
|
19
26
|
</div>
|
|
20
27
|
|
|
21
|
-
> G2 5.0
|
|
22
|
-
|
|
23
|
-
G2 的名字来自于 Wilkinson 的《Grammar of Graphics》,并在功能和 API 设计上深受它的启发。这里有一些资源可以帮助你开始使用它:
|
|
28
|
+
> G2 5.0 发布了 Beta 版本,4.x 稳定版在 [master](https://github.com/antvis/G2/tree/master) 分支上。
|
|
24
29
|
|
|
25
|
-
|
|
26
|
-
- [案例](http://g2-next.antv.vision/examples):大量可供学习和复制粘贴的案例
|
|
27
|
-
- [教程](http://g2-next.antv.vision/tutorials):交互式案例驱动的教程,帮助你了解核心概念
|
|
28
|
-
- [API](http://g2-next.antv.vision/basic):所有可视化组件的完整文档
|
|
30
|
+
G2 起源于 Wilkinson 的图形语法:《Grammar of Graphics》,但又不止于图形语法。
|
|
29
31
|
|
|
30
32
|
## ✨ 特色
|
|
31
33
|
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
34
|
+
- **渐进式语法**:结合工业和学术实践,实现图形语法、动画语法和交互语法。
|
|
35
|
+
- **丰富的标记**:内置 10+ 基础标记,8+ 高阶标记。
|
|
36
|
+
- **高可扩展性**:提供统一机制扩展所有可视化组件。
|
|
37
|
+
- **个性化风格**:支持手绘、圆角、纹理等风格。
|
|
38
|
+
- **多环境渲染**:支持 Canvas、SVG 以及 WebGL,和 Node.js 服务端渲染。
|
|
37
39
|
|
|
38
40
|
## 🔨 开始使用
|
|
39
41
|
|
|
40
|
-
可以通过
|
|
42
|
+
可以通过 NPM 或 Yarn 等包管理器来安装。
|
|
41
43
|
|
|
42
44
|
```bash
|
|
43
|
-
$ npm install @antv/g2
|
|
45
|
+
$ npm install @antv/g2@beta
|
|
44
46
|
```
|
|
45
47
|
|
|
46
48
|
```bash
|
|
47
|
-
$ yarn add @antv/g2
|
|
49
|
+
$ yarn add @antv/g2@beta
|
|
48
50
|
```
|
|
49
51
|
|
|
50
52
|
成功安装之后,可以通过 import 导入 Chart 对象。
|
|
51
53
|
|
|
52
54
|
```html
|
|
53
|
-
<div id="
|
|
55
|
+
<div id="container"></div>
|
|
54
56
|
```
|
|
55
57
|
|
|
56
58
|
```js
|
|
57
59
|
import { Chart } from '@antv/g2';
|
|
58
60
|
|
|
59
|
-
//
|
|
61
|
+
// 准备数据
|
|
60
62
|
const data = [
|
|
61
63
|
{ genre: 'Sports', sold: 275 },
|
|
62
64
|
{ genre: 'Strategy', sold: 115 },
|
|
@@ -65,19 +67,19 @@ const data = [
|
|
|
65
67
|
{ genre: 'Other', sold: 150 },
|
|
66
68
|
];
|
|
67
69
|
|
|
68
|
-
//
|
|
70
|
+
// 初始化图表实例
|
|
69
71
|
const chart = new Chart({
|
|
70
|
-
container: '
|
|
72
|
+
container: 'container',
|
|
71
73
|
});
|
|
72
74
|
|
|
73
75
|
// 声明可视化
|
|
74
76
|
chart
|
|
75
|
-
.interval() // 创建一个 Interval
|
|
76
|
-
.data(data) //
|
|
77
|
-
.encode('x', 'genre') //
|
|
78
|
-
.encode('y', 'sold'); //
|
|
77
|
+
.interval() // 创建一个 Interval 标记
|
|
78
|
+
.data(data) // 绑定数据
|
|
79
|
+
.encode('x', 'genre') // 编码 x 通道
|
|
80
|
+
.encode('y', 'sold'); // 编码 y 通道
|
|
79
81
|
|
|
80
|
-
//
|
|
82
|
+
// 渲染可视化
|
|
81
83
|
chart.render();
|
|
82
84
|
```
|
|
83
85
|
|
|
@@ -88,7 +90,7 @@ chart.render();
|
|
|
88
90
|
## 📮 参与贡献
|
|
89
91
|
|
|
90
92
|
- [问题](https://github.com/antvis/g2/issues): 报告 bug 或者提出需求
|
|
91
|
-
- [贡献指南](https://github.com/antvis/g2/blob/v5/CONTRIBUTING.
|
|
93
|
+
- [贡献指南](https://github.com/antvis/g2/blob/v5/CONTRIBUTING.md):参与建设 G2
|
|
92
94
|
- [讨论](https://github.com/antvis/G2/discussions):在 Github 上或者钉钉群里面讨论(30233731, 35686967, 44788198)
|
|
93
95
|
|
|
94
96
|
<img src="https://gw.alipayobjects.com/zos/antfincdn/hTzzaqgHgQ/Antv%252520G2%252520%26%252520G2Plot.png" width="200" height="266" />
|