Loading...
ComboCombined composite layout is suitable for graph data with composite group structures. It supports flexible configuration of the layout for elements inside combos as well as the layout between the outermost combos and nodes. By default, the internal elements use the Concentric layout, and the outer layout uses the gForce force-directed layout, balancing layout effect and overall stability. See more ComboCombined layout examples and source code.
Property | Description | Type | Default | Required |
---|---|---|---|---|
type | Layout type | combo-combined | - | ✓ |
center | Layout center | PointTuple | Graph center | |
comboPadding | Padding value inside the combo, used only for force calculation, not for rendering. It is recommended to set the same value as the visual padding. | ((d?: unknown) => number) | number | number[] | undefined | 10 | |
innerLayout | Layout algorithm for elements inside the combo, see below | Layout | ConcentricLayout | |
nodeSize | Node size (diameter), used for collision detection. If not specified, it is calculated from the node's size property, or defaults to 10. | number | number[] | (d?: NodeData) => number | 10 | |
outerLayout | Layout algorithm for the outermost layer, see below | Layout | ForceLayout | |
spacing | Minimum spacing between node/combo edges when preventNodeOverlap or preventOverlap is true . Can be a callback for different nodes. | number | (d?: NodeData) => number | - | |
treeKey | treeKey | string | - |
Layout<any>
Default:ConcentricLayout
The layout algorithm for elements inside the combo. Must use a synchronous layout algorithm. Default is ConcentricLayout. More layouts
Example:
import { ConcentricLayout } from '@antv/layout';new Graph({layout: {type: 'combo-combined',/*** See more ConcentricLayout options:* https://github.com/antvis/layout/blob/v5/packages/layout/src/types.ts#L397*/innerLayout: new ConcentricLayout({sortBy: 'id',nodeSize: 20,clockwise: true,}),},});
Layout<any>
Default:ForceLayout
The layout algorithm for the outermost layer. Default is ForceLayout. More layouts
Example
import { ForceLayout } from '@antv/layout';new Graph({layout: {type: 'combo-combined',/*** See more ForceLayout options:* https://github.com/antvis/layout/blob/v5/packages/layout/src/types.ts#L950*/outerLayout: new ForceLayout({gravity: 1,factor: 2,linkDistance: (edge: any, source: any, target: any) => {const nodeSize = ((source.size?.[0] || 30) + (target.size?.[0] || 30)) / 2;return Math.min(nodeSize * 1.5, 70);},}),},});