数据有布局信息
- 渲染节点:节点本身携带布局信息(x,y)
演示
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* eslint-disable no-undef */
import React from 'react';
import ReactDOM from 'react-dom';
import Graphin, { Utils } from '@antv/graphin';
import '@antv/graphin/dist/index.css'; // 引入Graphin CSS
const data = Utils.mock(20)
.random()
.graphin();
data.nodes.forEach(node => {
node.x = Math.random() * 500;
node.y = Math.random() * 500;
});
const App = () => {
return (
<div>
<Graphin data={data} />
</div>
);
};
const rootElement = document.getElementById('container');
ReactDOM.render(<App />, rootElement);
Enter to Rename, Shift+Enter to Preview