NetiPlot

Props — <NetiPlotReact>

All props accepted by the NetiPlotReact component (NetiPlotProps in types.ts).

Required

graphNetiPlotGraph

The graph data to render. See Graph data for the full type.

graph={{ nodes: [...], edges: [...] }}

Display

optionsNetiPlotOptions

Nested configuration object. See Options.

shapesNetiPlotShapeDefinition[]

Background shapes rendered behind the graph. See Background shapes.

classNamestring

CSS class name applied to the outermost container div.

customControls((data: CustomControlsData) => ReactNode) | null

Replace the built-in zoom controls with a custom renderer. Pass null to hide controls entirely.

customControls={({ zoomIn, zoomOut, fitAll }) => (
  <button onClick={fitAll}>Fit</button>
)}

Interaction

onMouseNetiPlotMouseHandler

Mouse event callback. See Mouse events.

nodeDrawingFunctionNodeDrawingFunction

Custom canvas draw function called for every node. See Custom drawing.

shapeDrawingFunctionShapeDrawingFunction

Custom canvas draw function called for every background shape.

imagesNetiPlotImageMap

Map of image IDs to HTMLImageElement, SVGImageElement, HTMLCanvasElement, or an object with { element, scale?, offsetX?, offsetY? }.

const img = new Image()
img.src = '/icon.png'
images={{ myIcon: img }}
// then on node: { id: 'n1', image: 'myIcon' }

Layout

layouterNetiPlotLayouter

Custom layout algorithm function. Defaults to built-in hierarchical layout. See Custom layouts.

shouldRunLayouterShouldRunLayouter

Predicate called when graph data changes. Return true to re-run the layout.

shouldRunLayouter={(prev, next) =>
  prev.graph.nodes.length !== next.graph.nodes.length
}

Programmatic access

callbackFn(data: NetiPlotCallbackData) => void

Called after mount. Provides imperative access to the network. See Programmatic access.

identifierstring

Stable string ID for this instance. Useful when multiple graphs are rendered on the same page.