@antv/g6 5.0.32 → 5.0.33
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 +33 -34
- package/README.zh-CN.md +117 -0
- package/dist/g6.min.js +29 -29
- package/dist/lib/behaviors/collapse-expand.d.ts +6 -0
- package/dist/lib/behaviors/drag-element.d.ts +1 -1
- package/dist/lib/elements/nodes/html.d.ts +4 -0
- package/dist/lib/exports.d.ts +1 -0
- package/dist/lib/plugins/snapline/index.d.ts +1 -1
- package/dist/lib/runtime/data.d.ts +1 -1
- package/dist/lib/runtime/element.d.ts +29 -2
- package/dist/lib/runtime/graph.d.ts +11 -9
- package/dist/lib/runtime/viewport.d.ts +22 -2
- package/dist/lib/spec/data.d.ts +2 -2
- package/dist/lib/utils/event/events.d.ts +4 -4
- package/dist/lib/utils/id.d.ts +1 -1
- package/dist/lib/utils/visibility.d.ts +1 -2
- package/dist/lib/version.d.ts +1 -1
- package/esm/behaviors/collapse-expand.d.ts +6 -0
- package/esm/behaviors/collapse-expand.js +4 -3
- package/esm/behaviors/collapse-expand.js.map +1 -1
- package/esm/behaviors/drag-element.d.ts +1 -1
- package/esm/behaviors/optimize-viewport-transform.js +1 -1
- package/esm/behaviors/optimize-viewport-transform.js.map +1 -1
- package/esm/elements/nodes/html.d.ts +4 -0
- package/esm/elements/nodes/html.js +7 -0
- package/esm/elements/nodes/html.js.map +1 -1
- package/esm/elements/shapes/base-shape.js +1 -1
- package/esm/elements/shapes/base-shape.js.map +1 -1
- package/esm/exports.d.ts +1 -0
- package/esm/plugins/hull/util.js +6 -1
- package/esm/plugins/hull/util.js.map +1 -1
- package/esm/plugins/snapline/index.d.ts +1 -1
- package/esm/preset.js +0 -2
- package/esm/preset.js.map +1 -1
- package/esm/runtime/data.d.ts +1 -1
- package/esm/runtime/data.js +8 -3
- package/esm/runtime/data.js.map +1 -1
- package/esm/runtime/element.d.ts +29 -2
- package/esm/runtime/element.js +34 -4
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/graph.d.ts +11 -9
- package/esm/runtime/graph.js +20 -15
- package/esm/runtime/graph.js.map +1 -1
- package/esm/runtime/viewport.d.ts +22 -2
- package/esm/runtime/viewport.js +12 -11
- package/esm/runtime/viewport.js.map +1 -1
- package/esm/spec/data.d.ts +2 -2
- package/esm/transforms/place-radial-labels.js +6 -1
- package/esm/transforms/place-radial-labels.js.map +1 -1
- package/esm/utils/event/events.d.ts +4 -4
- package/esm/utils/id.d.ts +1 -1
- package/esm/utils/visibility.d.ts +1 -2
- package/esm/utils/visibility.js +8 -34
- package/esm/utils/visibility.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/behaviors/collapse-expand.d.ts +6 -0
- package/lib/behaviors/collapse-expand.js +4 -3
- package/lib/behaviors/collapse-expand.js.map +1 -1
- package/lib/behaviors/drag-element.d.ts +1 -1
- package/lib/behaviors/optimize-viewport-transform.js +1 -1
- package/lib/behaviors/optimize-viewport-transform.js.map +1 -1
- package/lib/elements/edges/base-edge.js +17 -7
- package/lib/elements/edges/base-edge.js.map +1 -1
- package/lib/elements/nodes/html.d.ts +4 -0
- package/lib/elements/nodes/html.js +7 -0
- package/lib/elements/nodes/html.js.map +1 -1
- package/lib/elements/shapes/base-shape.js +1 -1
- package/lib/elements/shapes/base-shape.js.map +1 -1
- package/lib/exports.d.ts +1 -0
- package/lib/plugins/hull/util.js +5 -0
- package/lib/plugins/hull/util.js.map +1 -1
- package/lib/plugins/snapline/index.d.ts +1 -1
- package/lib/preset.js +0 -2
- package/lib/preset.js.map +1 -1
- package/lib/runtime/data.d.ts +1 -1
- package/lib/runtime/data.js +7 -2
- package/lib/runtime/data.js.map +1 -1
- package/lib/runtime/element.d.ts +29 -2
- package/lib/runtime/element.js +34 -4
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/graph.d.ts +11 -9
- package/lib/runtime/graph.js +20 -15
- package/lib/runtime/graph.js.map +1 -1
- package/lib/runtime/viewport.d.ts +22 -2
- package/lib/runtime/viewport.js +12 -11
- package/lib/runtime/viewport.js.map +1 -1
- package/lib/spec/data.d.ts +2 -2
- package/lib/transforms/place-radial-labels.js +6 -1
- package/lib/transforms/place-radial-labels.js.map +1 -1
- package/lib/utils/event/events.d.ts +4 -4
- package/lib/utils/id.d.ts +1 -1
- package/lib/utils/visibility.d.ts +1 -2
- package/lib/utils/visibility.js +8 -34
- package/lib/utils/visibility.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +8 -8
- package/src/behaviors/collapse-expand.ts +10 -3
- package/src/behaviors/optimize-viewport-transform.ts +1 -1
- package/src/elements/nodes/html.ts +9 -0
- package/src/elements/shapes/base-shape.ts +1 -1
- package/src/exports.ts +1 -0
- package/src/plugins/hull/util.ts +7 -1
- package/src/preset.ts +0 -3
- package/src/runtime/data.ts +11 -4
- package/src/runtime/element.ts +51 -4
- package/src/runtime/graph.ts +21 -17
- package/src/runtime/viewport.ts +36 -10
- package/src/spec/data.ts +2 -2
- package/src/transforms/place-radial-labels.ts +5 -1
- package/src/utils/visibility.ts +6 -35
- package/src/version.ts +1 -1
- package/README.en-US.md +0 -118
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<img src="https://gw.alipayobjects.com/zos/antfincdn/R8sN%24GNdh6/language.svg" width="18"> [
|
|
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
|
-
<b>G6
|
|
4
|
+
<b>G6: A Graph Visualization Framework in TypeScript</b>
|
|
5
5
|
</h1>
|
|
6
6
|
|
|
7
7
|

|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
[](https://www.npmjs.com/package/@antv/g6)
|
|
15
15
|
|
|
16
16
|
<p align="center">
|
|
17
|
-
<a href="https://g6.antv.antgroup.com/"
|
|
18
|
-
<a href="https://g6.antv.antgroup.com/examples"
|
|
19
|
-
<a href="https://g6.antv.antgroup.com/"
|
|
20
|
-
<a href="https://g6.antv.antgroup.com/">API</a>
|
|
17
|
+
<a href="https://g6.antv.antgroup.com/en">Introduction</a> •
|
|
18
|
+
<a href="https://g6.antv.antgroup.com/en/examples">Examples</a> •
|
|
19
|
+
<a href="https://g6.antv.antgroup.com/en/manual/getting-started/quick-start">Quick Start</a> •
|
|
20
|
+
<a href="https://g6.antv.antgroup.com/en/api/graph/method">API</a>
|
|
21
21
|
</p>
|
|
22
22
|
|
|
23
|
-
[G6](https://github.com/antvis/g6)
|
|
23
|
+
[G6](https://github.com/antvis/g6) is a graph visualization engine. It provides basic capabilities for graph visualization and analysis such as drawing, layout, analysis, interaction, animation, themes, and plugins. With G6, users can quickly build their own graph visualization and analysis applications, making relational data simple, transparent, and meaningful.
|
|
24
24
|
|
|
25
25
|
<img src='https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*_PJ5SZELwq0AAAAAAAAAAAAADmJ7AQ/original' width=550 alt='' />
|
|
26
26
|
|
|
@@ -32,36 +32,36 @@
|
|
|
32
32
|
|
|
33
33
|
<img src="https://user-images.githubusercontent.com/6113694/44995293-02858600-afd5-11e8-840c-349e4730d63d.gif" height=150 alt='' /><img src="https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*I9OdTbXJIi0AAAAAAAAAAABkARQnAQ" height=150 alt='' /><img src="https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*xoufSYcjK2AAAAAAAAAAAABkARQnAQ" height=150 alt='' />
|
|
34
34
|
|
|
35
|
-
## ✨
|
|
35
|
+
## ✨ Features
|
|
36
36
|
|
|
37
|
-
G6
|
|
37
|
+
G6, as a professional graph visualization engine, boasts the following features:
|
|
38
38
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
- **React
|
|
39
|
+
- **Rich Elements**: It comes with a variety of built-in node, edge, and Combo UI elements with extensive style configurations, supports data callbacks, and has a flexible mechanism for extending custom elements.
|
|
40
|
+
- **Controllable Interactions**: It includes more than 10 built-in interaction behaviors and offers a rich array of events, facilitating the expansion of custom interactive behaviors.
|
|
41
|
+
- **High-Performance Layout**: The engine features more than 10 common graph layouts, some of which leverage GPU and Rust parallel computing for enhanced performance, and it supports custom layout development.
|
|
42
|
+
- **Convenient Plugins**: Optimized built-in plugin functionality and performance, with flexible extensibility, making it easier to implement customized business capabilities.
|
|
43
|
+
- **Multiple Theme and Palettes**: Provides two sets of built-in themes, light and dark, that integrate over 20 popular community color palettes based on the AntV new color scheme.
|
|
44
|
+
- **Multi-Environment Rendering**: Harnessing the power of [G](https://github.com/antvis/g), it supports rendering in Canvas, SVG, and WebGL, as well as server-side rendering with Node.js; it also offers plugin packages that provide powerful 3D rendering and spatial interactions based on WebGL.
|
|
45
|
+
- **React Ecosystem**: By utilizing the React front-end ecosystem, it supports React nodes, significantly enriching the presentational styles of G6 nodes.
|
|
46
46
|
|
|
47
|
-
## 🔨
|
|
47
|
+
## 🔨 Getting Started
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
G6 is usually installed via a package manager such as npm or Yarn.
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
$ npm install @antv/g6
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
The `Graph` object then can be imported from G6.
|
|
56
56
|
|
|
57
57
|
```html
|
|
58
58
|
<div id="container"></div>
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
```
|
|
61
|
+
```js
|
|
62
62
|
import { Graph } from '@antv/g6';
|
|
63
63
|
|
|
64
|
-
//
|
|
64
|
+
// Get the Data.
|
|
65
65
|
const data = {
|
|
66
66
|
nodes: [
|
|
67
67
|
/* your nodes data */
|
|
@@ -71,7 +71,7 @@ const data = {
|
|
|
71
71
|
],
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
//
|
|
74
|
+
// Create the Graph instance.
|
|
75
75
|
const graph = new Graph({
|
|
76
76
|
container: 'container',
|
|
77
77
|
data,
|
|
@@ -87,30 +87,29 @@ const graph = new Graph({
|
|
|
87
87
|
behaviors: ['drag-canvas', 'drag-node'],
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
//
|
|
90
|
+
// Render the Graph.
|
|
91
91
|
graph.render();
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
All goes well, you can get the following lovely graph!
|
|
95
95
|
|
|
96
96
|
<img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*ue4iTYurc6sAAAAAAAAAAAAADmJ7AQ/fmt.webp" height="300" />
|
|
97
97
|
|
|
98
|
-
## 🌍
|
|
98
|
+
## 🌍 Ecosystem
|
|
99
99
|
|
|
100
|
-
- **Ant Design Charts
|
|
101
|
-
- **Graphin
|
|
100
|
+
- **Ant Design Charts**: A React chart library based on G2, G6, X6, L7.
|
|
101
|
+
- **Graphin**: A simple React wrapper based on G6, as well as an SDK for developing graph visualization applications.
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
For more ecosystem open-source projects, contributions are welcome. Please feel free to submit a PR for inclusion.
|
|
104
104
|
|
|
105
|
-
## 📮
|
|
105
|
+
## 📮 Contributing
|
|
106
106
|
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
107
|
+
- **Issue Reporting**: If you encounter any issues with G6 during use, please feel free to submit an issue, along with the minimal sample code that can reproduce the problem.
|
|
108
|
+
- **Contribution Guide**: Information on how to get involved in the [development and contribution](https://g6.antv.antgroup.com/en/manual/contribute) to G6.
|
|
109
|
+
- **Ideas Discussion**: Discuss your ideas on GitHub Discussions or in the DingTalk group.
|
|
110
110
|
|
|
111
|
-
<div>
|
|
111
|
+
<div align="center">
|
|
112
112
|
<img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*CQoGSoFBzaUAAAAAAAAAAAAADmJ7AQ/fmt.webp" height="256" />
|
|
113
|
-
<img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*yXJGSY8RC68AAAAAAAAAAAAADmJ7AQ/fmt.webp" height="256" />
|
|
114
113
|
</div>
|
|
115
114
|
|
|
116
115
|
## 📄 License
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
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>G6:图可视分析引擎</b>
|
|
5
|
+
</h1>
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@antv/g6)
|
|
10
|
+
[](https://github.com/antvis/g6/actions)
|
|
11
|
+
[](https://coveralls.io/github/antvis/G6)
|
|
12
|
+
[](https://www.npmjs.com/package/@antv/g6)
|
|
13
|
+

|
|
14
|
+
[](https://www.npmjs.com/package/@antv/g6)
|
|
15
|
+
|
|
16
|
+
<p align="center">
|
|
17
|
+
<a href="https://g6.antv.antgroup.com/manual/introduction">简介</a> •
|
|
18
|
+
<a href="https://g6.antv.antgroup.com/examples">图表示例</a> •
|
|
19
|
+
<a href="https://g6.antv.antgroup.com/manual/getting-started/quick-start">快速开始</a> •
|
|
20
|
+
<a href="https://g6.antv.antgroup.com/api/graph/method">API</a>
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
[G6](https://github.com/antvis/g6) 是一个图可视化引擎。它提供了图的绘制、布局、分析、交互、动画、主题、插件等图可视化和分析的基础能力。基于 G6,用户可以快速搭建自己的图可视化分析应用,让关系数据变得简单,透明,有意义。
|
|
24
|
+
|
|
25
|
+
<img src='https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*_PJ5SZELwq0AAAAAAAAAAAAADmJ7AQ/original' width=550 alt='' />
|
|
26
|
+
|
|
27
|
+
<img src='https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*zTjwQaXokeQAAAAAAAAAAABkARQnAQ' width=550 alt='' />
|
|
28
|
+
|
|
29
|
+
<img src='https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*zau8QJcVpDQAAAAAAAAAAABkARQnAQ' height=200 alt='' /><img src='https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RIlETY_S6IoAAAAAAAAAAABkARQnAQ' height=200 alt='' />
|
|
30
|
+
|
|
31
|
+
<img src='https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*cDzXR4jIWr8AAAAAAAAAAABkARQnAQ' height=150 alt='' /><img src='https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*HTasSJGC4koAAAAAAAAAAABkARQnAQ' height=150 alt='' />
|
|
32
|
+
|
|
33
|
+
<img src="https://user-images.githubusercontent.com/6113694/44995293-02858600-afd5-11e8-840c-349e4730d63d.gif" height=150 alt='' /><img src="https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*I9OdTbXJIi0AAAAAAAAAAABkARQnAQ" height=150 alt='' /><img src="https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*xoufSYcjK2AAAAAAAAAAAABkARQnAQ" height=150 alt='' />
|
|
34
|
+
|
|
35
|
+
## ✨ 特性
|
|
36
|
+
|
|
37
|
+
G6 作为一款专业的图可视化引擎,具有以下特性:
|
|
38
|
+
|
|
39
|
+
- **丰富的元素**:内置丰富的节点、边、Combo UI 元素,样式配置丰富,支持数据回调,且具备有灵活扩展自定义元素的机制。
|
|
40
|
+
- **可控的交互**:内置 10+ 交互行为,且提供丰富的各类事件,便于扩展自定义的交互行为。
|
|
41
|
+
- **高性能布局**:内置 10+ 常用的图布局,部分基于 GPU、Rust 并行计算提升性能,支持自定义布局。
|
|
42
|
+
- **便捷的组件**:优化内置组件功能及性能,且有灵活的扩展性,便于业务实现定制能力。
|
|
43
|
+
- **多主题色板**:提供了亮色、暗色两套内置主题,在 AntV 新色板前提下,融入 20+ 常用社区色板。
|
|
44
|
+
- **多环境渲染**:发挥 [G](https://github.com/antvis/g) 能力, 支持 Canvas、SVG 以及 WebGL,和 Node.js 服务端渲染;基于 WebGL 提供强大 3D 渲染和空间交互的插件包。
|
|
45
|
+
- **React 体系**:利用 React 前端生态,支持 React 节点,大大丰富 G6 的节点呈现样式。
|
|
46
|
+
|
|
47
|
+
## 🔨 开始使用
|
|
48
|
+
|
|
49
|
+
可以通过 NPM 或 Yarn 等包管理器来安装。
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
$ npm install @antv/g6
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
成功安装之后,可以通过 import 导入 `Graph` 对象。
|
|
56
|
+
|
|
57
|
+
```html
|
|
58
|
+
<div id="container"></div>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
import { Graph } from '@antv/g6';
|
|
63
|
+
|
|
64
|
+
// 准备数据
|
|
65
|
+
const data = {
|
|
66
|
+
nodes: [
|
|
67
|
+
/* your nodes data */
|
|
68
|
+
],
|
|
69
|
+
edges: [
|
|
70
|
+
/* your edges data */
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// 初始化图表实例
|
|
75
|
+
const graph = new Graph({
|
|
76
|
+
container: 'container',
|
|
77
|
+
data,
|
|
78
|
+
node: {
|
|
79
|
+
palette: {
|
|
80
|
+
type: 'group',
|
|
81
|
+
field: 'cluster',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
layout: {
|
|
85
|
+
type: 'force',
|
|
86
|
+
},
|
|
87
|
+
behaviors: ['drag-canvas', 'drag-node'],
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// 渲染图
|
|
91
|
+
graph.render();
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
一切顺利,你可以得到下面的力导图!
|
|
95
|
+
|
|
96
|
+
<img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*ue4iTYurc6sAAAAAAAAAAAAADmJ7AQ/fmt.webp" height="300" />
|
|
97
|
+
|
|
98
|
+
## 🌍 生态
|
|
99
|
+
|
|
100
|
+
- **Ant Design Charts**: React 图表库,基于 G2、G6、X6、L7。
|
|
101
|
+
- **Graphin**:基于 G6 的 React 简单封装,以及图可视化应用研发的 SDK。
|
|
102
|
+
|
|
103
|
+
更多生态开源项目,欢迎 PR 收录进来。
|
|
104
|
+
|
|
105
|
+
## 📮 贡献
|
|
106
|
+
|
|
107
|
+
- **问题反馈**:使用过程遇到的 G6 的问题,欢迎提交 Issue,并附上可以复现问题的最小案例代码。
|
|
108
|
+
- **贡献指南**:如何参与到 G6 的[开发和贡献](https://g6.antv.antgroup.com/manual/contribute)。
|
|
109
|
+
- **想法讨论**:在 GitHub Discussion 上或者钉钉群里面讨论。
|
|
110
|
+
|
|
111
|
+
<div>
|
|
112
|
+
<img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*CQoGSoFBzaUAAAAAAAAAAAAADmJ7AQ/fmt.webp" height="256" />
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
## 📄 License
|
|
116
|
+
|
|
117
|
+
[MIT](./LICENSE).
|