NetiPlot

Graph Data

The graph prop accepts a NetiPlotGraph object containing arrays of nodes and edges.

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

Node definition — NetiPlotNodeDefinition

FieldTypeRequiredDescription
idstringUnique identifier
labelstringText label rendered below the node
innerLabelstringShort text rendered inside the node circle
shapestringNode shape: 'circle' (default), 'square', 'image'
sizenumberOverride defaultSize for this node
imagestringKey into the images map
typestringArbitrary type string, available in drawing functions
fixedbooleanExclude this node from layout calculations
xnumberInitial x position
ynumberInitial y position
styleNodeStyleVisual overrides (see below)
[key: string]anyAny extra field — available in nodeDrawingFunction

Node style

style?: {
  background?: string   // fill colour
  border?: string       // stroke colour
  size?: number         // size override (same as top-level size)
  [key: string]: any    // additional fields for custom drawing
}

Edge definition — NetiPlotEdgeDefinition

FieldTypeRequiredDescription
idstringUnique identifier
fromstringSource node ID
tostringTarget node ID
labelstringText label rendered on the edge
sizenumberLine width override
styleNetiPlotEdgeStyleVisual overrides (see below)

Edge style

style?: {
  color?: string       // line colour
  lineWidth?: number   // line width in pixels
  font?: string        // label font string
  fontColor?: string   // label font colour
}

Example

const graph: NetiPlotGraph = {
  nodes: [
    { id: 'web',  label: 'Web App',  style: { background: '#3b82f6' } },
    { id: 'api',  label: 'API',      style: { background: '#8b5cf6' } },
    { id: 'db',   label: 'Database', style: { background: '#10b981' } },
  ],
  edges: [
    { id: 'e1', from: 'web', to: 'api' },
    { id: 'e2', from: 'api', to: 'db',  style: { color: '#ef4444' } },
  ],
}