A component that extends the ` with user interaction.
import React from 'react';
import { InteractiveForceGraph, ForceGraphNode, ForceGraphLink } from 'react-vis-force';
<InteractiveForceGraph
simulationOptions={{ height: 300, width: 300 }}
nodeLabelAttr="label"
onSelectNode={(node) => console.log(node)}
highlightDependencies
>
<ForceGraphNode node={{ id: 'first-node', label: 'First node' }} fill="red" />
<ForceGraphNode node={{ id: 'second-node', label: 'Second node' }} fill="blue" />
<ForceGraphLink link={{ source: 'first-node', target: 'second-node' }} />
</InteractiveForceGraph><InteractiveForceGraph /> inherits all of the props from <ForceGraph />, and adds:
Called each time the user selects a new node.
Called each time the user deselects a node.
The node to set to use as selected, if you want to treat the <InteractiveForceGraph /> as a managed component.
The node to set as selected by default.
When true, the dependencies of a hovered or selected node are given the highlighted treatment. By default, this will show labels for highlighted nodes and links.
Used to scale opacity when hovering or selecting nodes. Ex. 0.6