Loading...
Displays a series of nodes (such as entities, objects, or concepts) and their connections or relationships.
import { NetworkGraph } from '@ant-design/graphs';
Use when you need to visualize nodes and their relationships in a complex network structure, revealing connection patterns and data flow intuitively.
For general graph properties, refer to: General Graph Properties
Graph data. If the expand-collapse
behavior is enabled, make sure the children
field is included in the data.
const graphData = {nodes: [{ id: '1', data: { label: 'Node 1' }, children: ['2', '3'] },{ id: '2', data: { label: 'Node 2' }, children: ['4'] },{ id: '3', data: { label: 'Node 3' } },{ id: '4', data: { label: 'Node 4' } },],edges: [{ source: '1', target: '2' },{ source: '1', target: '3' },{ source: '2', target: '4' },],};
D3 Force layout. Common parameters are as follows:
collide: Force to prevent node overlap.
Property | Description | Type | Default Value |
---|---|---|---|
collide.radius | Collision radius of nodes | number | - |
collide.strength | strength of collision force | number | - |
link: Used to simulate the connection relationship between nodes, ensuring that the connected nodes remain within a certain distance range.
Property | Description | Type | Default Value |
---|---|---|---|
link.distance | The ideal distance between two nodes | number | - |
link.strength | The strength of the link, controlling the tightness of the connection between nodes | number | - |
manyBody: The gravitational or repulsive force between nodes.
Property | Description | Type | Default Value |
---|---|---|---|
manyBody.strength | The strength of the gravitational or repulsive force between nodes | number | - |
manyBody.theta | Barnes-Hut approximation parameter for calculating multi-body forces | number | - |
For complete parameters, refer to d3-force