Loading...
new Graph(options: Options)
| Option | Type | Required | Description | Default Value |
|---|---|---|---|---|
| container | HTMLElement | ✓ | The container of the canvas. | |
| width | number | The width of the canvas, defaults to the container width. | - | |
| height | number | The height of the canvas, defaults to the container height. | - | |
| scaling | { min?: number, max?: number } | The minimum and maximum zoom levels of the canvas. | { min: 0.01, max: 16 } | |
| autoResize | boolean | Element | Document | Whether to listen to container size changes and automatically update the canvas size. | false | |
| panning | boolean | PanningManager.Options | Whether the canvas can be panned, defaults to disabled. | false | |
| mousewheel | boolean | MouseWheel.Options | Whether the mouse wheel can zoom, defaults to disabled. | false | |
| grid | boolean | number | GridManager.Options | The grid, defaults to a 10px grid but does not draw the grid background. | false | |
| background | false | BackgroundManager.Options | The background, defaults to not drawing the background. | false | |
| translating | Translating.Options | Restricts node movement. After a node is moved, automatically offset when it overlaps with other nodes. | { restrict: false, autoOffset: true } | |
| embedding | boolean | Embedding.Options | Whether to enable nested nodes, defaults to disabled. | false | |
| connecting | Connecting.Options | The connection options. | { snap: false, ... } | |
| highlighting | Highlighting.Options | The highlighting options. | {...} | |
| interacting | Interacting.Options | Customizes the interaction behavior of nodes and edges. | { edgeLabelMovable: false } | |
| magnetThreshold | number | onleave | The number of times the mouse can move before triggering a connection, or set to onleave to trigger a connection when the mouse leaves an element. | 0 | |
| moveThreshold | number | The number of times the mouse can move before triggering a mousemove event. | 0 | |
| clickThreshold | number | When the mouse moves more than the specified number of times, the mouse click event will not be triggered. | 0 | |
| preventDefaultContextMenu | boolean | Whether to disable the browser's default right-click menu. | true | |
| preventDefaultBlankAction | boolean | Whether to disable the default mouse behavior when clicking on a blank area of the canvas. | true | |
| async | boolean | Whether to render asynchronously. | true | |
| virtual | boolean | Whether to only render the visible area of the canvas. | false | |
| onPortRendered | (args: OnPortRenderedArgs) => void | The callback triggered when a port is rendered. | - | |
| onEdgeLabelRendered | (args: OnEdgeLabelRenderedArgs) => void | The callback triggered when an edge label is rendered. | - | |
| createCellView | (cell: Cell) => CellView | null | undefined | Customizes the view of a cell. | - |