UNPKG

767 BMarkdownView Raw
1## About
2
3Layout algorithms for AntV
4
5## Installation
6
7```shell
8# npm
9$ npm install @antv/layout --save
10
11# yarn
12$ yarn add @antv/layout
13```
14
15## Usage
16
17```ts
18import { GridLayout } from '@antv/layout'
19
20const model = {
21 nodes: [
22 {
23 id: 'node1',
24 x: 0,
25 y: 0,
26 }, {
27 id: 'node2',
28 x: 20,
29 y: 20,
30 },
31 ],
32 edges: [
33 {
34 source: 'node1',
35 target: 'node2',
36 },
37 ],
38}
39
40const gridLayout = new GridLayout({
41 type: 'grid',
42 width: 600,
43 height: 400,
44 rows: 4,
45 cols: 4,
46})
47
48const newModel = gridLayout.layout(model)
49
50```
51
52## Documentation
53
54- [G6 Layout](https://g6.antv.vision/zh/docs/api/graphLayout/guide)
55
56## License
57
58The scripts and documentation in this project are released under the [MIT License](LICENSE).