Installation and usage
You can install the library with the following:
npm install @neo4j-nvl/base
If you want to use the React wrapper, install it with the following:
npm install @neo4j-nvl/react
Once installed, you can use the core library for a basic graph by first importing the NVL class:
import { NVL } from '@neo4j-nvl/base'
You can then generate a graph:
const nodes = [{ id: '1' }, { id: '2' }]
const relationships = [{ id: '12', from: '1', to: '2' }]
const nvl = new NVL(document.getElementById('container'), nodes, relationships)
Ensure that the container used to render the graph has a height attribute. If the container is missing this attribute, the container’s height is set to 0 and the graph is not visible. |
If you want to add common interactivity to the graph, you can install the NVL interaction handlers. See Interaction handlers for more information.