Installation and usage
You can install the library with the following:
npm install @neo4j-nvl/base
Once installed, you can use the base library for a basic graph by first importing the NVL class:
xml
This is just text actually
js
This is just text actually
go
import { NVL } from '@neo4j-nvl/base'
js
import { NVL } from '@neo4j-nvl/base'
You can then generate a graph:
js
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. If you are using React, you can make use of the React wrappers.
See the nvl-boilerplates GitHub repository for boilerplate code to create a new project with NVL.