NetworkCanvas

@nivo/networkcanvas

A variation around the Network component. Well suited for large data sets as it does not impact DOM tree depth, however you'll lose the isomorphic ability and transitions.

The responsive alternative of this component is ResponsiveNetworkCanvas.

Please note that you can also use the useNetwork React hook if you want to handle the rendering by yourself, it accepts an object with almost the same props as the component and returns computed nodes & links.

133 nodes
Actions Logs
Start interacting with the chart to log actions
Base
{ nodes: NetworkInputNode[], links: NetworkInputLink[] }required

Chart data defining nodes and links.

numberrequired

Chart width.

numberrequired

Chart height.

numberoptionaldefault:'Depends on device'

Adjust pixel ratio, useful for HiDPI screens.

supportsvgcanvas
objectoptional
px
px
px
px

Chart margin.

Simulation
number | string | (link: Link) => numberoptional

Control links' distance.

numberoptionaldefault:1

Control how much the centering force affects nodes positioning.

numberoptionaldefault:10

Control how nodes repel each other.

numberoptionaldefault:1

Sets the minimum distance between nodes for the many-body force.

numberoptionaldefault:Infinity

Sets the maximum disteance between nodes for the many-body force.

numberoptionaldefault:120

Adjust the simulation quality.

Style
Themeoptional

Define style for common elements such as labels, axes…

Nodes
NetworkNodeComponentoptionaldefault:'NetworkNode'

Custom node component for the SVG implementation.

supportsvgcanvas
NetworkNodeCanvasRendereroptional

Custom node rendering for the canvas implementation.

supportsvgcanvas
number | (node: InputNode) => numberoptionaldefault:12
dynamic: (node: InputNode) => node.size
px

Control nodes' size.

number | (node: InputNode) => numberoptionaldefault:18
dynamic: (node: InputNode) => node.size * 1.5
px

Control active nodes' size.

number | (node: InputNode) => numberoptionaldefault:8
px

Control inactive nodes' size.

string | (node: InputNode) => stringoptionaldefault:'#000000'

Control nodes' color.

number | (node: NetworkComputedNode) => numberoptionaldefault:0
px

Control nodes' border width.

InheritedColorConfig<NetworkComputedNode>optionaldefault:{"from":"color"}
inheritthemecustom
inherited property
color
modifiers
darker

Control nodes' border color.

Links
Interactivity
booleanoptionaldefault:true
   

Enable/disable interactivity.

NetworkNodeTooltipComponentoptional

Custom tooltip component for nodes.

(node: NetworkComputedNode, event: MouseEvent) => voidoptional

onClick handler.

(node: ComputedNode, event: MouseEvent) => voidoptional

onMouseEnter handler.

supportsvgcanvas
(node: ComputedNode, event: MouseEvent) => voidoptional

onMouseMove handler.

supportsvgcanvas
(node: ComputedNode, event: MouseEvent) => voidoptional

onMouseLeave handler.

supportsvgcanvas
Annotations
AnnotationMatcher[]optionaldefault:[]

Annotations for nodes.

add annotation
Customization
('links' | 'nodes')[] | FunctionComponent<LayerProps>optionaldefault:['links', 'nodes', 'annotations']

Defines the order of layers and add custom layers.

Accessibility
stringoptional

Main element role attribute.

supportsvgcanvas
stringoptional

Main element aria-label.

supportsvgcanvas
stringoptional

Main element aria-labelledby.

supportsvgcanvas
stringoptional

Main element aria-describedby.

supportsvgcanvas
Motion
booleanoptionaldefault:true

Enable/disable transitions.

supportsvgcanvas
string | objectoptionaldefault:'gentle'

Motion config for react-spring, either a preset or a custom configuration.

supportsvgcanvas