setData(data) | Set the graph data (nodes and links). Automatically triggers layout simulation and loading states. |
getData() | Get the current graph data in the simplified format. |
setGraphData(data) | Set graph data in the internal format (with computed properties). Use for better performance when you already have GraphData format. |
getGraphData() | Get the current graph data in the internal format with all computed properties. |
setConfig(config) | Configure the graph visualization and behavior. Accepts a ForceGraphConfig object. |
setWidth(width) | Set canvas width in pixels. |
setHeight(height) | Set canvas height in pixels. |
setBackgroundColor(color) | Set background color (hex or CSS color). |
setForegroundColor(color) | Set foreground color for text and borders. |
setAnimation(enabled) | Enable or disable force simulation animation. When disabled, pins all nodes in place. |
setPinOnDragEnd(pin) | Enable or disable pinning nodes after dragging. |
setLayout(layoutMode) | Switch layout mode: 'force', 'tree', or 'radial'. |
setLayoutOptions(options) | Update per-layout options (tree, radial, force). Triggers re-layout. |
setDebug(enabled) | Enable or disable debug logging to console. |
refresh() | Trigger a repaint after in-place property mutations (visibility, color, size). |
getViewport() | Get current zoom and center position as ViewportState. |
setViewport(viewport) | Restore a previously saved viewport state. |
getZoom() | Get current zoom level. |
zoom(zoomLevel) | Set zoom level. |
zoomToFit(paddingMultiplier, filter) | Auto-fit all visible nodes in view. Optional padding multiplier and node filter function. |
getGraph() | Get the underlying force-graph instance for advanced control. |
getCullingStats() | Get viewport culling statistics (bounds, visible vs total node/link counts). |