Merge pull request #4909 from antvis/v5-doc-0901

chore: refine doc
This commit is contained in:
Yanyan Wang 2023-09-01 15:49:40 +08:00 committed by GitHub
commit c5160068a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 12 deletions

View File

@ -80,15 +80,15 @@ $ npm install @antv/g6@5.0.0-beta.2
<img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*M-MTRaLiZN0AAAAAAAAAAAAADmJ7AQ/original" width=437 height=148 alt='' />
The configuration specification of the graph can be refered to: https://github.com/antvis/G6/blob/v5/packages/g6/src/types/spec.ts
The configuration specification of the graph can be refered to: [Specification Doc](https://g6-next.antv.antgroup.com/en/apis/interfaces/graph/specification)
Graph API: https://github.com/antvis/G6/blob/2b44df189dd2e851447ba5a09541c372b49cd658/packages/g6/src/types/graph.ts#L23
Graph API: [Graph API](https://g6-next.antv.antgroup.com/en/apis/interfaces/graph/i-graph)
A simple graph demo:
<img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*M-MTRaLiZN0AAAAAAAAAAAAADmJ7AQ/original" width=437 height=138 alt='' />
[![Edit compassionate-lalande-5lxm7](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/embed/musing-matan-q255po?fontsize=14&hidenavigation=1&theme=dark)
[![Edit compassionate-lalande-5lxm7](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/g6-v5-beta-quick-start-m3yncv?from-embed=&file=/index.js)
```js
import G6 from '@antv/g6';

View File

@ -66,15 +66,15 @@ $ npm install @antv/g6@5.0.0-beta.2
## 使用 (5.0 Beta)
【TODOapi link】图配置 Specification 类型见https://github.com/antvis/G6/blob/v5/packages/g6/src/types/spec.ts
图配置 Specification 类型见:[Specification Doc](https://g6-next.antv.antgroup.com/apis/interfaces/graph/specification)
【TODOapi link】Graph API 见https://github.com/antvis/G6/blob/2b44df189dd2e851447ba5a09541c372b49cd658/packages/g6/src/types/graph.ts#L23
Graph API 见:[Graph API](https://g6-next.antv.antgroup.com/apis/interfaces/graph/i-graph)
【TODObeta demo】最简单的图 Demo
最简单的图 Demo
<img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*M-MTRaLiZN0AAAAAAAAAAAAADmJ7AQ/original" width=437 height=138 alt='' />
[![Edit compassionate-lalande-5lxm7](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/embed/musing-matan-q255po?fontsize=14&hidenavigation=1&theme=dark)
[![Edit compassionate-lalande-5lxm7](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/g6-v5-beta-quick-start-m3yncv?from-embed=&file=/index.js)
```js
import G6 from '@antv/g6';

View File

@ -31,7 +31,7 @@ To support these new capabilities, there are significant Breaking Changes in G6
### JSON Spec Definition
[JSON Specification Type]()
[Specification Doc](https://g6-next.antv.antgroup.com/apis/interfaces/graph/specification)
In v5, we standardize the graphics of all nodes/edges/combos. Each type of element has several standardized graphic names. This standard should also be followed for custom elements. If there are additional graphics, they should be placed in otherShapes.

View File

@ -29,9 +29,9 @@ order: 2
## 1⃣. 视觉与动画规范
### JSON spec 定义
### JSON Spec 定义
【TODO JSON spec api 地址】
[Specification Doc](https://g6-next.antv.antgroup.com/apis/interfaces/graph/specification)
v5 中我们将所有节点/边/ combo 的图形进行规范化,每种类型的元素基本都有若干个规范的图形名称。包括自定义的元素,也应当遵循这样的规范。如果有额外的图形,统一放入 otherShapes 中。

View File

@ -1,4 +1,10 @@
import G6 from '@antv/g6';
import { Graph, extend, Extensions } from '@antv/g6';
const ExtGraph = extend(Graph, {
nodes: {
'ellipse-node': Extensions.EllipseNode,
},
});
const data = {
nodes: [
@ -58,7 +64,7 @@ const data = {
const container = document.getElementById('container');
const width = container.scrollWidth;
const height = container.scrollHeight || 500;
const graph = new G6.Graph({
const graph = new ExtGraph({
container: 'container',
width,
height,