@antv/g2 5.0.20 → 5.0.21

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.
Files changed (229) hide show
  1. package/README.md +32 -34
  2. package/README.zh-CN.md +99 -0
  3. package/dist/g2-lite.min.js +4 -4
  4. package/dist/g2.min.js +4 -4
  5. package/esm/api/runtime.js +2 -2
  6. package/esm/api/runtime.js.map +1 -1
  7. package/esm/api/utils.d.ts +5 -0
  8. package/esm/api/utils.js +3 -2
  9. package/esm/api/utils.js.map +1 -1
  10. package/esm/component/axis.d.ts +11 -1
  11. package/esm/component/axis.js +46 -11
  12. package/esm/component/axis.js.map +1 -1
  13. package/esm/component/axisX.js +7 -4
  14. package/esm/component/axisX.js.map +1 -1
  15. package/esm/component/axisY.js +6 -2
  16. package/esm/component/axisY.js.map +1 -1
  17. package/esm/component/axisZ.d.ts +8 -0
  18. package/esm/component/axisZ.js +14 -0
  19. package/esm/component/axisZ.js.map +1 -0
  20. package/esm/component/index.d.ts +1 -0
  21. package/esm/component/index.js +1 -0
  22. package/esm/component/index.js.map +1 -1
  23. package/esm/component/scrollbar.d.ts +2 -1
  24. package/esm/component/scrollbar.js +1 -1
  25. package/esm/component/scrollbar.js.map +1 -1
  26. package/esm/composition/mark.js +3 -1
  27. package/esm/composition/mark.js.map +1 -1
  28. package/esm/coordinate/cartesian3D.d.ts +7 -0
  29. package/esm/coordinate/cartesian3D.js +6 -0
  30. package/esm/coordinate/cartesian3D.js.map +1 -0
  31. package/esm/coordinate/index.d.ts +2 -0
  32. package/esm/coordinate/index.js +1 -0
  33. package/esm/coordinate/index.js.map +1 -1
  34. package/esm/index.d.ts +1 -1
  35. package/esm/index.js +1 -1
  36. package/esm/index.js.map +1 -1
  37. package/esm/interaction/event.js +20 -9
  38. package/esm/interaction/event.js.map +1 -1
  39. package/esm/lib/index.d.ts +1 -0
  40. package/esm/lib/index.js +1 -0
  41. package/esm/lib/index.js.map +1 -1
  42. package/esm/lib/threed.d.ts +5 -0
  43. package/esm/lib/threed.js +11 -0
  44. package/esm/lib/threed.js.map +1 -0
  45. package/esm/mark/index.d.ts +1 -0
  46. package/esm/mark/index.js +1 -0
  47. package/esm/mark/index.js.map +1 -1
  48. package/esm/mark/point3D.d.ts +9 -0
  49. package/esm/mark/point3D.js +76 -0
  50. package/esm/mark/point3D.js.map +1 -0
  51. package/esm/mark/utils.d.ts +7 -0
  52. package/esm/mark/utils.js +6 -0
  53. package/esm/mark/utils.js.map +1 -1
  54. package/esm/runtime/component.js +6 -3
  55. package/esm/runtime/component.js.map +1 -1
  56. package/esm/runtime/coordinate.js +9 -4
  57. package/esm/runtime/coordinate.js.map +1 -1
  58. package/esm/runtime/layout.d.ts +1 -0
  59. package/esm/runtime/layout.js +109 -29
  60. package/esm/runtime/layout.js.map +1 -1
  61. package/esm/runtime/plot.js +5 -3
  62. package/esm/runtime/plot.js.map +1 -1
  63. package/esm/runtime/render.js +12 -3
  64. package/esm/runtime/render.js.map +1 -1
  65. package/esm/runtime/types/common.d.ts +4 -0
  66. package/esm/runtime/types/component.d.ts +8 -2
  67. package/esm/runtime/types/options.d.ts +5 -1
  68. package/esm/shape/index.d.ts +2 -0
  69. package/esm/shape/index.js +2 -0
  70. package/esm/shape/index.js.map +1 -1
  71. package/esm/shape/point3D/cube.d.ts +6 -0
  72. package/esm/shape/point3D/cube.js +70 -0
  73. package/esm/shape/point3D/cube.js.map +1 -0
  74. package/esm/shape/point3D/sphere.d.ts +6 -0
  75. package/esm/shape/point3D/sphere.js +70 -0
  76. package/esm/shape/point3D/sphere.js.map +1 -0
  77. package/esm/shape/shape/shape.js +2 -2
  78. package/esm/shape/shape/shape.js.map +1 -1
  79. package/esm/shape/utils.d.ts +2 -2
  80. package/esm/shape/utils.js +2 -2
  81. package/esm/shape/utils.js.map +1 -1
  82. package/esm/spec/component.d.ts +1 -1
  83. package/esm/spec/composition.d.ts +2 -0
  84. package/esm/spec/coordinate.d.ts +5 -2
  85. package/esm/spec/index.d.ts +1 -0
  86. package/esm/spec/index.js.map +1 -1
  87. package/esm/spec/mark.d.ts +2 -2
  88. package/esm/transform/index.d.ts +1 -0
  89. package/esm/transform/index.js +1 -0
  90. package/esm/transform/index.js.map +1 -1
  91. package/esm/transform/maybeZeroZ.d.ts +6 -0
  92. package/esm/transform/maybeZeroZ.js +22 -0
  93. package/esm/transform/maybeZeroZ.js.map +1 -0
  94. package/esm/utils/size.d.ts +1 -0
  95. package/esm/utils/size.js +1 -0
  96. package/esm/utils/size.js.map +1 -1
  97. package/lib/api/runtime.js +2 -2
  98. package/lib/api/runtime.js.map +1 -1
  99. package/lib/api/utils.d.ts +5 -0
  100. package/lib/api/utils.js +3 -2
  101. package/lib/api/utils.js.map +1 -1
  102. package/lib/component/axis.d.ts +11 -1
  103. package/lib/component/axis.js +48 -12
  104. package/lib/component/axis.js.map +1 -1
  105. package/lib/component/axisX.js +6 -3
  106. package/lib/component/axisX.js.map +1 -1
  107. package/lib/component/axisY.js +5 -1
  108. package/lib/component/axisY.js.map +1 -1
  109. package/lib/component/axisZ.d.ts +8 -0
  110. package/lib/component/axisZ.js +19 -0
  111. package/lib/component/axisZ.js.map +1 -0
  112. package/lib/component/index.d.ts +1 -0
  113. package/lib/component/index.js +3 -1
  114. package/lib/component/index.js.map +1 -1
  115. package/lib/component/scrollbar.d.ts +2 -1
  116. package/lib/component/scrollbar.js +1 -1
  117. package/lib/component/scrollbar.js.map +1 -1
  118. package/lib/composition/mark.js +3 -1
  119. package/lib/composition/mark.js.map +1 -1
  120. package/lib/coordinate/cartesian3D.d.ts +7 -0
  121. package/lib/coordinate/cartesian3D.js +10 -0
  122. package/lib/coordinate/cartesian3D.js.map +1 -0
  123. package/lib/coordinate/index.d.ts +2 -0
  124. package/lib/coordinate/index.js +3 -1
  125. package/lib/coordinate/index.js.map +1 -1
  126. package/lib/index.d.ts +1 -1
  127. package/lib/index.js +2 -1
  128. package/lib/index.js.map +1 -1
  129. package/lib/interaction/event.js +20 -9
  130. package/lib/interaction/event.js.map +1 -1
  131. package/lib/lib/index.d.ts +1 -0
  132. package/lib/lib/index.js +3 -1
  133. package/lib/lib/index.js.map +1 -1
  134. package/lib/lib/threed.d.ts +5 -0
  135. package/lib/lib/threed.js +15 -0
  136. package/lib/lib/threed.js.map +1 -0
  137. package/lib/mark/index.d.ts +1 -0
  138. package/lib/mark/index.js +3 -1
  139. package/lib/mark/index.js.map +1 -1
  140. package/lib/mark/point3D.d.ts +9 -0
  141. package/lib/mark/point3D.js +80 -0
  142. package/lib/mark/point3D.js.map +1 -0
  143. package/lib/mark/utils.d.ts +7 -0
  144. package/lib/mark/utils.js +8 -1
  145. package/lib/mark/utils.js.map +1 -1
  146. package/lib/runtime/component.js +6 -3
  147. package/lib/runtime/component.js.map +1 -1
  148. package/lib/runtime/coordinate.js +8 -3
  149. package/lib/runtime/coordinate.js.map +1 -1
  150. package/lib/runtime/layout.d.ts +1 -0
  151. package/lib/runtime/layout.js +112 -31
  152. package/lib/runtime/layout.js.map +1 -1
  153. package/lib/runtime/plot.js +4 -2
  154. package/lib/runtime/plot.js.map +1 -1
  155. package/lib/runtime/render.js +12 -3
  156. package/lib/runtime/render.js.map +1 -1
  157. package/lib/runtime/types/common.d.ts +4 -0
  158. package/lib/runtime/types/component.d.ts +8 -2
  159. package/lib/runtime/types/options.d.ts +5 -1
  160. package/lib/shape/index.d.ts +2 -0
  161. package/lib/shape/index.js +6 -2
  162. package/lib/shape/index.js.map +1 -1
  163. package/lib/shape/point3D/cube.d.ts +6 -0
  164. package/lib/shape/point3D/cube.js +74 -0
  165. package/lib/shape/point3D/cube.js.map +1 -0
  166. package/lib/shape/point3D/sphere.d.ts +6 -0
  167. package/lib/shape/point3D/sphere.js +74 -0
  168. package/lib/shape/point3D/sphere.js.map +1 -0
  169. package/lib/shape/shape/shape.js +2 -2
  170. package/lib/shape/shape/shape.js.map +1 -1
  171. package/lib/shape/utils.d.ts +2 -2
  172. package/lib/shape/utils.js +2 -2
  173. package/lib/shape/utils.js.map +1 -1
  174. package/lib/spec/component.d.ts +1 -1
  175. package/lib/spec/composition.d.ts +2 -0
  176. package/lib/spec/coordinate.d.ts +5 -2
  177. package/lib/spec/index.d.ts +1 -0
  178. package/lib/spec/index.js.map +1 -1
  179. package/lib/spec/mark.d.ts +2 -2
  180. package/lib/transform/index.d.ts +1 -0
  181. package/lib/transform/index.js +3 -1
  182. package/lib/transform/index.js.map +1 -1
  183. package/lib/transform/maybeZeroZ.d.ts +6 -0
  184. package/lib/transform/maybeZeroZ.js +26 -0
  185. package/lib/transform/maybeZeroZ.js.map +1 -0
  186. package/lib/utils/size.d.ts +1 -0
  187. package/lib/utils/size.js +1 -0
  188. package/lib/utils/size.js.map +1 -1
  189. package/package.json +10 -3
  190. package/src/api/runtime.ts +2 -2
  191. package/src/api/utils.ts +3 -2
  192. package/src/component/axis.ts +65 -9
  193. package/src/component/axisX.ts +8 -3
  194. package/src/component/axisY.ts +8 -3
  195. package/src/component/axisZ.ts +25 -0
  196. package/src/component/index.ts +1 -0
  197. package/src/component/scrollbar.ts +3 -2
  198. package/src/composition/mark.ts +4 -0
  199. package/src/coordinate/cartesian3D.ts +11 -0
  200. package/src/coordinate/index.ts +2 -0
  201. package/src/index.ts +1 -1
  202. package/src/interaction/event.ts +22 -9
  203. package/src/lib/index.ts +1 -0
  204. package/src/lib/threed.ts +11 -0
  205. package/src/mark/index.ts +1 -0
  206. package/src/mark/point3D.ts +90 -0
  207. package/src/mark/utils.ts +7 -0
  208. package/src/runtime/component.ts +6 -0
  209. package/src/runtime/coordinate.ts +18 -10
  210. package/src/runtime/layout.ts +178 -33
  211. package/src/runtime/plot.ts +11 -3
  212. package/src/runtime/render.ts +14 -3
  213. package/src/runtime/types/common.ts +4 -0
  214. package/src/runtime/types/component.ts +10 -1
  215. package/src/runtime/types/options.ts +5 -0
  216. package/src/shape/index.ts +2 -0
  217. package/src/shape/point3D/cube.ts +68 -0
  218. package/src/shape/point3D/sphere.ts +68 -0
  219. package/src/shape/shape/shape.ts +9 -6
  220. package/src/shape/utils.ts +4 -4
  221. package/src/spec/component.ts +1 -1
  222. package/src/spec/composition.ts +2 -0
  223. package/src/spec/coordinate.ts +6 -0
  224. package/src/spec/index.ts +1 -0
  225. package/src/spec/mark.ts +7 -1
  226. package/src/transform/index.ts +1 -0
  227. package/src/transform/maybeZeroZ.ts +25 -0
  228. package/src/utils/size.ts +2 -0
  229. package/README.en-US.md +0 -99
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <img src="https://gw.alipayobjects.com/zos/antfincdn/R8sN%24GNdh6/language.svg" width="18"> [English](./README.en-US.md) | 简体中文
1
+ <img src="https://gw.alipayobjects.com/zos/antfincdn/R8sN%24GNdh6/language.svg" width="18"> English | [简体中文](./README.zh-CN.md)
2
2
 
3
3
  <h1 align="center">
4
4
  <b>G2 5.0</b>
@@ -6,14 +6,7 @@
6
6
 
7
7
  <div align="center">
8
8
 
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>
9
+ G2 is a visualization grammar for dashboard building, data exploration and storytelling.
17
10
 
18
11
  [![Build Status](https://github.com/antvis/g2/workflows/build/badge.svg?branch=v5)](https://github.com/antvis//actions)
19
12
  [![Coverage Status](https://img.shields.io/coveralls/github/antvis/g2/v5.svg)](https://coveralls.io/github/antvis/g2?branch=v5)
@@ -21,23 +14,28 @@
21
14
  [![npm Download](https://img.shields.io/npm/dm/@antv/g2.svg)](https://www.npmjs.com/package/@antv/g2)
22
15
  [![npm License](https://img.shields.io/npm/l/@antv/g2.svg)](https://www.npmjs.com/package/@antv/g2)
23
16
 
24
- ![examples](https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*FW0gRrLzlMgAAAAAAAAAAAAADmJ7AQ/original)
17
+ ![examples](https://gw.alipayobjects.com/mdn/rms_dfc253/afts/img/A*o4YET5i12oMAAAAAAAAAAAAAARQnAQ)
25
18
 
26
19
  </div>
27
20
 
28
- G2 起源于 Leland Wilkinson 的图形语法:《The Grammar of Graphics》,但又不止于图形语法。
21
+ G2 is named after Leland Wilkinson’s book _The Grammar of Graphics_ and was profoundly inspired by it in the very beginning. Here are some resources you can begin with:
22
+
23
+ - [Introduction](https://g2.antv.antgroup.com/manual/introduction/what-is-g2) - a brief overview and G2's motivations
24
+ - [Examples](https://g2.antv.antgroup.com/examples) - a large number of demos to learn from and copy-paste
25
+ - [Tutorials](https://g2.antv.antgroup.com/manual/introduction/getting-started) - interactive case-driven guides of G2's core concepts
26
+ - [API Reference](https://g2.antv.antgroup.com/api/overview) - complete documentation for all visualization components
29
27
 
30
- ## ✨ 特色
28
+ ## ✨ Features
31
29
 
32
- - **渐进式语法**:结合工业和学术实践,实现图形语法、动画语法和交互语法。
33
- - **丰富的标记**:内置 10+ 基础标记,8+ 高阶标记。
34
- - **高可扩展性**:提供统一机制扩展所有可视化组件。
35
- - **个性化风格**:支持手绘、圆角、纹理等风格。
36
- - **多环境渲染**:支持 Canvas、SVG 以及 WebGL,和 Node.js 服务端渲染。
30
+ - **Progressive Usage** - The main objective of G2 is to help you get meaningful visualizations quickly with concise declarations and it infers the rest. But you can configure much more for complex and advanced situations.
31
+ - **Declarative API** - We employs a functional declarative API to specify chart options in a programmatic fashion, which contributes to better logic reuse and more flexible code organization.
32
+ - **High Extensibility** - To satisfy specific needs, G2 provides a convenient and consistent mechanism to extend everything you can imagine, whether a scale, a transform, a mark, etc,. You can even customize a brand new visualization tool based on this mechanism.
33
+ - **Comprehensive Grammar** - G2 rejects a chart typology in favor of marks, transforms, scales, coordinates, and compositions. In addition to static visual representations, it's possible to declare data-driven animations and apply well-designed action-based interactions to plots as well.
34
+ - **Powerful Renderer** - There is a powerful renderer [G](https://github.com/antvis/G) under G2 to generate web-based visualizations using Canvas, SVG or WebGL. The plenty of plugins it has benefit G2 from rendering charts with novel styles such as hand-drawn and fully embrace the ecosystem of [D3](https://github.com/d3/d3).
37
35
 
38
- ## 🔨 开始使用
36
+ ## 🔨 Getting Started
39
37
 
40
- 可以通过 NPM 或 Yarn 等包管理器来安装。
38
+ G2 is usually installed via a package manager such as npm or Yarn.
41
39
 
42
40
  ```bash
43
41
  $ npm install @antv/g2@next
@@ -47,7 +45,7 @@ $ npm install @antv/g2@next
47
45
  $ yarn add @antv/g2@next
48
46
  ```
49
47
 
50
- 成功安装之后,可以通过 import 导入 Chart 对象。
48
+ The Chart object then can be imported from G2.
51
49
 
52
50
  ```html
53
51
  <div id="container"></div>
@@ -56,7 +54,7 @@ $ yarn add @antv/g2@next
56
54
  ```js
57
55
  import { Chart } from '@antv/g2';
58
56
 
59
- // 准备数据
57
+ // A tabular data to be visualized.
60
58
  const data = [
61
59
  { genre: 'Sports', sold: 275 },
62
60
  { genre: 'Strategy', sold: 115 },
@@ -65,35 +63,35 @@ const data = [
65
63
  { genre: 'Other', sold: 150 },
66
64
  ];
67
65
 
68
- // 初始化图表实例
66
+ // Instantiate a new chart.
69
67
  const chart = new Chart({
70
68
  container: 'container',
71
69
  theme: 'classic',
72
70
  });
73
71
 
74
- // 声明可视化
72
+ // Specify visualization.
75
73
  chart
76
- .interval() // 创建一个 Interval 标记
77
- .data(data) // 绑定数据
78
- .encode('x', 'genre') // 编码 x 通道
79
- .encode('y', 'sold'); // 编码 y 通道
74
+ .interval() // Create an interval mark and add it to the chart.
75
+ .data(data) // Bind data for this mark.
76
+ .encode('x', 'genre') // Assign genre column to x position channel.
77
+ .encode('y', 'sold'); // Assign sold column to y position channel.
80
78
 
81
- // 渲染可视化
79
+ // Render visualization。
82
80
  chart.render();
83
81
  ```
84
82
 
85
- 如果一切顺利,你可以得到下面的柱状图!
83
+ If all goes well, you can get the following lovely bar chart!
86
84
 
87
85
  <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*K-7URYaij4kAAAAAAAAAAAAADmJ7AQ/original" width="640" height="480" alt="example">
88
86
 
89
- ## 📮 参与贡献
87
+ ## 📮 Contributing
90
88
 
91
- - [问题](https://github.com/antvis/g2/issues): 报告 bug 或者提出需求
92
- - [贡献指南](https://github.com/antvis/g2/blob/v5/CONTRIBUTING.md):参与建设 G2
93
- - [讨论](https://github.com/antvis/G2/discussions):在 Github 上或者钉钉群里面讨论(30233731, 35686967, 44788198)
89
+ - [Issues](https://github.com/antvis/g2/issues) - report bugs or request features
90
+ - [Contributing Guide](https://github.com/antvis/g2/blob/v5/CONTRIBUTING.md) - help build G2
91
+ - [Discussions](https://github.com/antvis/G2/discussions) - discuss on GitHub or in DingTalk group(30233731, 35686967, 44788198)
94
92
 
95
93
  <img src="https://gw.alipayobjects.com/zos/antfincdn/hTzzaqgHgQ/Antv%252520G2%252520%26%252520G2Plot.png" width="200" height="266" alt="code"/>
96
94
 
97
- ## 📄 许可证
95
+ ## 📄 License
98
96
 
99
97
  MIT@[AntV](https://github.com/antvis).
@@ -0,0 +1,99 @@
1
+ <img src="https://gw.alipayobjects.com/zos/antfincdn/R8sN%24GNdh6/language.svg" width="18"> [English](./README.md) | 简体中文
2
+
3
+ <h1 align="center">
4
+ <b>G2 5.0</b>
5
+ </h1>
6
+
7
+ <div align="center">
8
+
9
+ 简洁的渐进式可视化语法,用于构建仪表盘、数据探索以及数据讲故事。
10
+
11
+ <p align="center">
12
+ <a href="https://g2.antv.antgroup.com/manual/introduction/what-is-g2">介绍</a> •
13
+ <a href="https://g2.antv.antgroup.com/examples">案例</a> •
14
+ <a href="https://g2.antv.antgroup.com/manual/introduction/getting-started">教程</a> •
15
+ <a href="https://g2.antv.antgroup.com/api/overview">API</a>
16
+ </p>
17
+
18
+ [![Build Status](https://github.com/antvis/g2/workflows/build/badge.svg?branch=v5)](https://github.com/antvis//actions)
19
+ [![Coverage Status](https://img.shields.io/coveralls/github/antvis/g2/v5.svg)](https://coveralls.io/github/antvis/g2?branch=v5)
20
+ [![npm Version](https://img.shields.io/npm/v/@antv/g2.svg)](https://www.npmjs.com/package/@antv/g2)
21
+ [![npm Download](https://img.shields.io/npm/dm/@antv/g2.svg)](https://www.npmjs.com/package/@antv/g2)
22
+ [![npm License](https://img.shields.io/npm/l/@antv/g2.svg)](https://www.npmjs.com/package/@antv/g2)
23
+
24
+ ![examples](https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*FW0gRrLzlMgAAAAAAAAAAAAADmJ7AQ/original)
25
+
26
+ </div>
27
+
28
+ G2 起源于 Leland Wilkinson 的图形语法:《The Grammar of Graphics》,但又不止于图形语法。
29
+
30
+ ## ✨ 特色
31
+
32
+ - **渐进式语法**:结合工业和学术实践,实现图形语法、动画语法和交互语法。
33
+ - **丰富的标记**:内置 10+ 基础标记,8+ 高阶标记。
34
+ - **高可扩展性**:提供统一机制扩展所有可视化组件。
35
+ - **个性化风格**:支持手绘、圆角、纹理等风格。
36
+ - **多环境渲染**:支持 Canvas、SVG 以及 WebGL,和 Node.js 服务端渲染。
37
+
38
+ ## 🔨 开始使用
39
+
40
+ 可以通过 NPM 或 Yarn 等包管理器来安装。
41
+
42
+ ```bash
43
+ $ npm install @antv/g2@next
44
+ ```
45
+
46
+ ```bash
47
+ $ yarn add @antv/g2@next
48
+ ```
49
+
50
+ 成功安装之后,可以通过 import 导入 Chart 对象。
51
+
52
+ ```html
53
+ <div id="container"></div>
54
+ ```
55
+
56
+ ```js
57
+ import { Chart } from '@antv/g2';
58
+
59
+ // 准备数据
60
+ const data = [
61
+ { genre: 'Sports', sold: 275 },
62
+ { genre: 'Strategy', sold: 115 },
63
+ { genre: 'Action', sold: 120 },
64
+ { genre: 'Shooter', sold: 350 },
65
+ { genre: 'Other', sold: 150 },
66
+ ];
67
+
68
+ // 初始化图表实例
69
+ const chart = new Chart({
70
+ container: 'container',
71
+ theme: 'classic',
72
+ });
73
+
74
+ // 声明可视化
75
+ chart
76
+ .interval() // 创建一个 Interval 标记
77
+ .data(data) // 绑定数据
78
+ .encode('x', 'genre') // 编码 x 通道
79
+ .encode('y', 'sold'); // 编码 y 通道
80
+
81
+ // 渲染可视化
82
+ chart.render();
83
+ ```
84
+
85
+ 如果一切顺利,你可以得到下面的柱状图!
86
+
87
+ <img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*K-7URYaij4kAAAAAAAAAAAAADmJ7AQ/original" width="640" height="480" alt="example">
88
+
89
+ ## 📮 参与贡献
90
+
91
+ - [问题](https://github.com/antvis/g2/issues): 报告 bug 或者提出需求
92
+ - [贡献指南](https://github.com/antvis/g2/blob/v5/CONTRIBUTING.zh-CN.md):参与建设 G2
93
+ - [讨论](https://github.com/antvis/G2/discussions):在 GitHub 上或者钉钉群里面讨论(30233731, 35686967, 44788198)
94
+
95
+ <img src="https://gw.alipayobjects.com/zos/antfincdn/hTzzaqgHgQ/Antv%252520G2%252520%26%252520G2Plot.png" width="200" height="266" alt="code"/>
96
+
97
+ ## 📄 许可证
98
+
99
+ MIT@[AntV](https://github.com/antvis).