@neo4j-nvl/base 2.0.0 → 2.1.0-307fceac
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -1
- package/README.md +12 -0
- package/dist/base.mjs +35891 -2
- package/dist/types/index.d.ts +417 -387
- package/dist/types/layouts/animatedlayout/AnimatedLayout.d.ts +23 -23
- package/dist/types/layouts/animatedlayout/animationUtils.d.ts +3 -3
- package/dist/types/layouts/circularLayout/CircularLayout.d.ts +14 -14
- package/dist/types/layouts/d3forcelayout/circularLayout.d.ts +4 -4
- package/dist/types/layouts/d3forcelayout/constants.d.ts +3 -3
- package/dist/types/layouts/d3forcelayout/d3ForceLayout.d.ts +31 -31
- package/dist/types/layouts/d3forcelayout/types.d.ts +7 -7
- package/dist/types/layouts/forcedirectedlayout/PhysLayout.d.ts +261 -261
- package/dist/types/layouts/forcedirectedlayout/clustering/ClusterByMerger.d.ts +52 -52
- package/dist/types/layouts/forcedirectedlayout/clustering/SolarMerger.d.ts +49 -49
- package/dist/types/layouts/forcedirectedlayout/clustering/clustering-utils.d.ts +35 -35
- package/dist/types/layouts/forcedirectedlayout/clustering/types.d.ts +39 -39
- package/dist/types/layouts/forcedirectedlayout/glwrapper.d.ts +3 -3
- package/dist/types/layouts/forcedirectedlayout/shaders/multilevel-fragment.d.ts +1 -1
- package/dist/types/layouts/forcedirectedlayout/shaders/multilevel-repulsive-fragment.d.ts +1 -1
- package/dist/types/layouts/forcedirectedlayout/shaders/multilevel-update-fragment.d.ts +1 -1
- package/dist/types/layouts/forcedirectedlayout/shaders/sim-vertex.d.ts +1 -1
- package/dist/types/layouts/freeLayout/FreeLayout.d.ts +23 -23
- package/dist/types/layouts/gridLayout/GridLayout.d.ts +26 -26
- package/dist/types/layouts/hierarchicallayout/HierarchicalLayout.d.ts +28 -28
- package/dist/types/layouts/hierarchicallayout/constants.d.ts +2 -2
- package/dist/types/modules/CallbackHelper.d.ts +23 -23
- package/dist/types/modules/ExternalCallbackHandler.d.ts +46 -33
- package/dist/types/modules/NvlController.d.ts +212 -209
- package/dist/types/modules/Shader.d.ts +17 -17
- package/dist/types/modules/ZoomTransitionHandler.d.ts +24 -24
- package/dist/types/modules/dataset.d.ts +24 -24
- package/dist/types/modules/logging.d.ts +4 -4
- package/dist/types/modules/state/constants.d.ts +2 -2
- package/dist/types/modules/state/state.d.ts +2 -2
- package/dist/types/modules/state/types.d.ts +316 -281
- package/dist/types/modules/state/utils.d.ts +36 -36
- package/dist/types/renderers/ClusterOverlay.d.ts +67 -67
- package/dist/types/renderers/domrenderer/BaseRenderer.d.ts +69 -69
- package/dist/types/renderers/domrenderer/canvasrenderer/Animation.d.ts +57 -57
- package/dist/types/renderers/domrenderer/canvasrenderer/AnimationHandler.d.ts +65 -65
- package/dist/types/renderers/domrenderer/canvasrenderer/CanvasRenderer.d.ts +84 -85
- package/dist/types/renderers/domrenderer/canvasrenderer/arrowDrawing.d.ts +31 -31
- package/dist/types/renderers/domrenderer/canvasrenderer/nodeDrawing.d.ts +32 -32
- package/dist/types/renderers/domrenderer/shared/ImageCache.d.ts +16 -16
- package/dist/types/renderers/domrenderer/shared/arrows/ArrowBundle.d.ts +89 -89
- package/dist/types/renderers/domrenderer/shared/arrows/ArrowBundler.d.ts +42 -42
- package/dist/types/renderers/domrenderer/shared/arrows/arrows.d.ts +49 -49
- package/dist/types/renderers/domrenderer/shared/arrows/constants.d.ts +4 -4
- package/dist/types/renderers/domrenderer/shared/nodes/nodes.d.ts +21 -21
- package/dist/types/renderers/domrenderer/shared/types.d.ts +29 -29
- package/dist/types/renderers/domrenderer/shared/util.d.ts +4 -4
- package/dist/types/renderers/domrenderer/shared/vectorUtils.d.ts +10 -10
- package/dist/types/renderers/domrenderer/shared/wordwrap.d.ts +10 -10
- package/dist/types/renderers/domrenderer/svgrenderer/SvgRenderer.d.ts +18 -19
- package/dist/types/renderers/domrenderer/svgrenderer/arrowDrawing.d.ts +15 -15
- package/dist/types/renderers/domrenderer/svgrenderer/nodeDrawing.d.ts +4 -4
- package/dist/types/renderers/domrenderer/svgrenderer/svgUtils.d.ts +21 -21
- package/dist/types/renderers/webglrenderer/Controller.d.ts +83 -82
- package/dist/types/renderers/webglrenderer/IconLayerRegistry.d.ts +8 -8
- package/dist/types/renderers/webglrenderer/Renderer.d.ts +89 -89
- package/dist/types/renderers/webglrenderer/node-animation-fragment.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/node-animation-vertex.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/node-fragment-point.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/node-vertex-point.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/rel-fragment-line.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/rel-glsl-utils.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/rel-vertex-arrow.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/rel-vertex-line.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/viewport-box-fragment.d.ts +1 -1
- package/dist/types/renderers/webglrenderer/viewport-box-vertex.d.ts +1 -1
- package/dist/types/types/graph-element.d.ts +121 -104
- package/dist/types/types/nvl-window-functions.d.ts +28 -13
- package/dist/types/types/utils.d.ts +1 -1
- package/dist/types/utils/ariaUtils.d.ts +2 -2
- package/dist/types/utils/canvasManagement.d.ts +7 -1
- package/dist/types/utils/circularUtils.d.ts +2 -2
- package/dist/types/utils/clusterGeometry.d.ts +3 -3
- package/dist/types/utils/clusterHitRegions.d.ts +12 -12
- package/dist/types/utils/colorUtils.d.ts +2 -2
- package/dist/types/utils/constants.d.ts +6 -6
- package/dist/types/utils/errors.d.ts +6 -6
- package/dist/types/utils/geometry.d.ts +48 -48
- package/dist/types/utils/graphObjectUtils.d.ts +9 -9
- package/dist/types/utils/hitTest.d.ts +87 -0
- package/dist/types/utils/jsDriverResultTransformer.d.ts +26 -16
- package/dist/types/utils/layoutSeeding.d.ts +2 -2
- package/dist/types/utils/mouseUtils.d.ts +5 -5
- package/dist/types/utils/segmentAnalytics.d.ts +42 -42
- package/dist/types/utils/webWorkerUtils.d.ts +1 -1
- package/dist/types/utils/zoomFunctions.d.ts +17 -17
- package/package.json +15 -15
- package/skills/neo4j-nvl-skill/README.md +39 -0
- package/skills/neo4j-nvl-skill/SKILL.md +300 -0
- package/skills/neo4j-nvl-skill/references/api/base/classes/NVL.md +1020 -0
- package/skills/neo4j-nvl-skill/references/api/base/functions/getZoomTargetForNodePositions.md +37 -0
- package/skills/neo4j-nvl-skill/references/api/base/index.md +72 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/CircularOptions.md +11 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/ClusteringOptions.md +31 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/ExternalCallbacks.md +18 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/ForceDirectedOptions.md +12 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/HierarchicalOptions.md +13 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/HitTargetCluster.md +13 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/HitTargetNode.md +16 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/HitTargetRelationship.md +15 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/Node.md +32 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/NvlMouseEvent.md +16 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/NvlOptions.md +38 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/NvlWindow.md +18 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/Point.md +12 -0
- package/skills/neo4j-nvl-skill/references/api/base/interfaces/Relationship.md +32 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/CanvasRendererType.md +14 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/Cluster.md +20 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/ClusterByFn.md +20 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/ClusterId.md +10 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/HitTargets.md +22 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/HitTestTarget.md +9 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/Layout.md +15 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/LayoutOptions.md +12 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/NodeWithClientPosition.md +24 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/PartialNode.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/PartialRelationship.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/Renderer.md +11 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/StyledCaption.md +21 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/WebGLRendererType.md +14 -0
- package/skills/neo4j-nvl-skill/references/api/base/type-aliases/ZoomOptions.md +25 -0
- package/skills/neo4j-nvl-skill/references/api/base/variables/CircularLayoutType.md +11 -0
- package/skills/neo4j-nvl-skill/references/api/base/variables/ForceDirectedLayoutType.md +9 -0
- package/skills/neo4j-nvl-skill/references/api/base/variables/FreeLayoutType.md +9 -0
- package/skills/neo4j-nvl-skill/references/api/base/variables/GridLayoutType.md +9 -0
- package/skills/neo4j-nvl-skill/references/api/base/variables/HierarchicalLayoutType.md +9 -0
- package/skills/neo4j-nvl-skill/references/api/base/variables/d3ForceLayoutType.md +9 -0
- package/skills/neo4j-nvl-skill/references/api/base/variables/nvlResultTransformer.md +49 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/BoxSelectInteraction.md +163 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/ClickInteraction.md +163 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/DragNodeInteraction.md +164 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/HoverInteraction.md +166 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/KeyboardInteraction.md +185 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/LassoInteraction.md +163 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/PanInteraction.md +197 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/classes/ZoomInteraction.md +169 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/index.md +37 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/BoxSelectInteractionCallbacks.md +19 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/BoxSelectInteractionOptions.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/ClickInteractionCallbacks.md +39 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/ClickInteractionOptions.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/DragNodeInteractionCallbacks.md +21 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/DrawInteractionOptions.md +22 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/HoverInteractionCallbacks.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/HoverInteractionOptions.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/KeyboardInteractionCallbacks.md +35 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/KeyboardInteractionOptions.md +55 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/LassoInteractionCallbacks.md +19 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/LassoInteractionOptions.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/PanInteractionCallbacks.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/PanInteractionOptions.md +19 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/ZoomInteractionCallbacks.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/interaction-handlers/type-aliases/ZoomInteractionOptions.md +17 -0
- package/skills/neo4j-nvl-skill/references/api/react/functions/StaticPictureWrapper.md +42 -0
- package/skills/neo4j-nvl-skill/references/api/react/index.md +34 -0
- package/skills/neo4j-nvl-skill/references/api/react/interfaces/BasicReactWrapperProps.md +24 -0
- package/skills/neo4j-nvl-skill/references/api/react/interfaces/InteractiveNvlWrapperProps.md +27 -0
- package/skills/neo4j-nvl-skill/references/api/react/type-aliases/InteractionOptions.md +10 -0
- package/skills/neo4j-nvl-skill/references/api/react/type-aliases/KeyboardEvent.md +10 -0
- package/skills/neo4j-nvl-skill/references/api/react/type-aliases/KeyboardEventCallbacks.md +10 -0
- package/skills/neo4j-nvl-skill/references/api/react/type-aliases/MouseEvent.md +10 -0
- package/skills/neo4j-nvl-skill/references/api/react/type-aliases/MouseEventCallbacks.md +19 -0
- package/skills/neo4j-nvl-skill/references/api/react/type-aliases/StaticPictureWrapperProps.md +27 -0
- package/skills/neo4j-nvl-skill/references/api/react/variables/BasicNvlWrapper.md +65 -0
- package/skills/neo4j-nvl-skill/references/api/react/variables/InteractiveNvlWrapper.md +18 -0
- package/skills/neo4j-nvl-skill/references/clustering.md +87 -0
- package/skills/neo4j-nvl-skill/references/data-from-neo4j.md +67 -0
- package/skills/neo4j-nvl-skill/references/labels-and-overlays.md +78 -0
- package/skills/neo4j-nvl-skill/references/layouts-and-positions.md +65 -0
- package/skills/neo4j-nvl-skill/references/lifecycle-and-updates.md +65 -0
- package/skills/neo4j-nvl-skill/references/migrating-1x-to-2.md +50 -0
- package/skills/neo4j-nvl-skill/references/react-wrappers.md +92 -0
- package/skills/neo4j-nvl-skill/references/verifying-nvl-apps.md +52 -0
- package/skills/neo4j-nvl-skill/references/vite-and-bundlers.md +62 -0
- package/dist/base.mjs.LICENSE.txt +0 -21
- package/dist/types/layouts/animatedlayout/AnimatedLayout.test.d.ts +0 -1
- package/dist/types/layouts/animatedlayout/animationUtils.test.d.ts +0 -1
- package/dist/types/layouts/d3forcelayout/__mocks__/d3ForceLayout.d.ts +0 -10
- package/dist/types/layouts/d3forcelayout/circularLayout.test.d.ts +0 -1
- package/dist/types/layouts/d3forcelayout/d3ForceLayout.test.d.ts +0 -1
- package/dist/types/layouts/forcedirectedlayout/PhysLayout.test.d.ts +0 -1
- package/dist/types/layouts/forcedirectedlayout/clustering/ClusterByMerger.test.d.ts +0 -1
- package/dist/types/layouts/forcedirectedlayout/clustering/SolarMerger.bench.d.ts +0 -1
- package/dist/types/layouts/forcedirectedlayout/clustering/SolarMerger.test.d.ts +0 -1
- package/dist/types/layouts/forcedirectedlayout/clustering/clustering-utils.test.d.ts +0 -1
- package/dist/types/modules/NvlController.test.d.ts +0 -1
- package/dist/types/modules/ZoomTransitionHandler.test.d.ts +0 -1
- package/dist/types/modules/dataset.test.d.ts +0 -1
- package/dist/types/modules/state/state.test.d.ts +0 -1
- package/dist/types/modules/state/utils.test.d.ts +0 -1
- package/dist/types/renderers/ClusterOverlay.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/BaseRenderer.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/canvasrenderer/Animation.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/canvasrenderer/CanvasRenderer.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/canvasrenderer/arrowDrawing.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/canvasrenderer/nodeDrawing.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/shared/ImageCache.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/shared/arrows/ArrowBundle.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/shared/arrows/ArrowBundler.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/shared/arrows/arrows.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/shared/nodes/nodes.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/shared/util.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/shared/wordwrap.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/svgrenderer/SvgRenderer.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/svgrenderer/arrowDrawing.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/svgrenderer/nodeDrawing.test.d.ts +0 -1
- package/dist/types/renderers/domrenderer/svgrenderer/svgUtils.test.d.ts +0 -1
- package/dist/types/renderers/webglrenderer/Controller.test.d.ts +0 -1
- package/dist/types/renderers/webglrenderer/IconLayerRegistry.test.d.ts +0 -1
- package/dist/types/renderers/webglrenderer/Renderer.test.d.ts +0 -1
- package/dist/types/utils/ariaUtils.test.d.ts +0 -1
- package/dist/types/utils/canvasManagement.test.d.ts +0 -1
- package/dist/types/utils/circularUtils.test.d.ts +0 -1
- package/dist/types/utils/clusterGeometry.test.d.ts +0 -1
- package/dist/types/utils/clusterHitRegions.test.d.ts +0 -1
- package/dist/types/utils/colorUtils.test.d.ts +0 -1
- package/dist/types/utils/errors.test.d.ts +0 -1
- package/dist/types/utils/geometry.test.d.ts +0 -1
- package/dist/types/utils/graphObjectUtils.test.d.ts +0 -1
- package/dist/types/utils/hittest.d.ts +0 -84
- package/dist/types/utils/hittest.test.d.ts +0 -1
- package/dist/types/utils/jsDriverResultTransformer.test.d.ts +0 -1
- package/dist/types/utils/layoutSeeding.test.d.ts +0 -1
- package/dist/types/utils/mouseUtils.test.d.ts +0 -1
- package/dist/types/utils/webWorkerUtils.test.d.ts +0 -1
- package/dist/types/utils/zoomFunctions.test.d.ts +0 -1
|
@@ -0,0 +1,1020 @@
|
|
|
1
|
+
[//]: # (This file is auto-generated by scripts/docs/generate-skills.mjs, do not edit it manually)
|
|
2
|
+
|
|
3
|
+
# Class: NVL
|
|
4
|
+
|
|
5
|
+
Class for a NVL instance.
|
|
6
|
+
|
|
7
|
+
## Example
|
|
8
|
+
|
|
9
|
+
This is a basic setup for a NVL instance.
|
|
10
|
+
```ts
|
|
11
|
+
import { NVL } from '@neo4j-nvl/base'
|
|
12
|
+
|
|
13
|
+
const nodes = [{ id: '1' }, { id: '2' }]
|
|
14
|
+
const relationships = [{ id: '12', from: '1', to: '2' }]
|
|
15
|
+
|
|
16
|
+
const options = { initialZoom: 0.5 }
|
|
17
|
+
|
|
18
|
+
const callbacks = {
|
|
19
|
+
onLayoutDone: () => console.log('Layout done')
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const nvl = new NVL(document.getElementById('frame'), nodes, relationships, options, callbacks)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Constructors
|
|
26
|
+
|
|
27
|
+
### Constructor
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
new NVL(
|
|
31
|
+
frame,
|
|
32
|
+
nvlNodes?,
|
|
33
|
+
nvlRels?,
|
|
34
|
+
options?,
|
|
35
|
+
callbacks?
|
|
36
|
+
): NVL;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Creates a new NVL instance.
|
|
40
|
+
|
|
41
|
+
#### Parameters
|
|
42
|
+
|
|
43
|
+
| Parameter | Type | Default value | Description |
|
|
44
|
+
| ------ | ------ | ------ | ------ |
|
|
45
|
+
| `frame` | `HTMLElement` | `undefined` | The DOM element to display the graph in. |
|
|
46
|
+
| `nvlNodes` | [`Node`](../interfaces/Node.md)[] | `[]` | An array of [nodes](../interfaces/Node.md). |
|
|
47
|
+
| `nvlRels` | [`Relationship`](../interfaces/Relationship.md)[] | `[]` | An array of [relationships](../interfaces/Relationship.md). |
|
|
48
|
+
| `options` | [`NvlOptions`](../interfaces/NvlOptions.md) | `{}` | The [options](../interfaces/NvlOptions.md) for the NVL instance. |
|
|
49
|
+
| `callbacks` | [`ExternalCallbacks`](../interfaces/ExternalCallbacks.md) | `{}` | Callbacks triggered on NVL events. |
|
|
50
|
+
|
|
51
|
+
#### Returns
|
|
52
|
+
|
|
53
|
+
`NVL`
|
|
54
|
+
|
|
55
|
+
## Methods
|
|
56
|
+
|
|
57
|
+
### addAndUpdateElementsInGraph()
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
addAndUpdateElementsInGraph(nodes?, relationships?): void;
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Adds nodes and relationships to NVL and updates existing nodes and relationships.
|
|
64
|
+
|
|
65
|
+
#### Parameters
|
|
66
|
+
|
|
67
|
+
| Parameter | Type | Default value | Description |
|
|
68
|
+
| ------ | ------ | ------ | ------ |
|
|
69
|
+
| `nodes` | \| [`Node`](../interfaces/Node.md)[] \| [`PartialNode`](../type-aliases/PartialNode.md)[] | `[]` | An Array of [nodes](../interfaces/Node.md) to be added or updated. |
|
|
70
|
+
| `relationships` | \| [`Relationship`](../interfaces/Relationship.md)[] \| [`PartialRelationship`](../type-aliases/PartialRelationship.md)[] | `[]` | An Array of [relationships](../interfaces/Relationship.md) to be added or updated. To update nodes or relationships, they must have an id that matches the id of the node or relationship to be updated. Only the properties that are provided will be updated. If an existing property is not provided, it will not be changed. |
|
|
71
|
+
|
|
72
|
+
#### Returns
|
|
73
|
+
|
|
74
|
+
`void`
|
|
75
|
+
|
|
76
|
+
#### Example
|
|
77
|
+
|
|
78
|
+
Adding and updating nodes and relationships
|
|
79
|
+
```ts
|
|
80
|
+
import { NVL } from '@neo4j-nvl/base'
|
|
81
|
+
|
|
82
|
+
const nvl = new NVL(document.getElementById('frame'), [{ id: '0' }], [])
|
|
83
|
+
|
|
84
|
+
const nodes = [
|
|
85
|
+
{ id: '1', caption: 'Node 1', color: '#e04141' },
|
|
86
|
+
{ id: '2', caption: 'Node 2', color: '#e09c41' }
|
|
87
|
+
]
|
|
88
|
+
const relationships = [{ id: '12', from: '1', to: '2' }]
|
|
89
|
+
// Adds new nodes and relationships
|
|
90
|
+
nvl.addAndUpdateElementsInGraph(nodes, relationships)
|
|
91
|
+
// Updates an existing relationship
|
|
92
|
+
nvl.addAndUpdateElementsInGraph([], [{ id: '12', color: '#e0df41' }])
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
***
|
|
96
|
+
|
|
97
|
+
### addElementsToGraph()
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
addElementsToGraph(nodes, relationships): void;
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Adds nodes and relationships in the current scene.
|
|
104
|
+
|
|
105
|
+
#### Parameters
|
|
106
|
+
|
|
107
|
+
| Parameter | Type | Description |
|
|
108
|
+
| ------ | ------ | ------ |
|
|
109
|
+
| `nodes` | [`Node`](../interfaces/Node.md)[] | The nodes to be added. |
|
|
110
|
+
| `relationships` | [`Relationship`](../interfaces/Relationship.md)[] | The relationships to be added. |
|
|
111
|
+
|
|
112
|
+
#### Returns
|
|
113
|
+
|
|
114
|
+
`void`
|
|
115
|
+
|
|
116
|
+
#### Remarks
|
|
117
|
+
|
|
118
|
+
Elements whose id already exists are skipped silently; use
|
|
119
|
+
[addAndUpdateElementsInGraph](#addandupdateelementsingraph) to add and update in one call.
|
|
120
|
+
|
|
121
|
+
***
|
|
122
|
+
|
|
123
|
+
### deselectAll()
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
deselectAll(): void;
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
De-selects all nodes and relationships.
|
|
130
|
+
|
|
131
|
+
#### Returns
|
|
132
|
+
|
|
133
|
+
`void`
|
|
134
|
+
|
|
135
|
+
***
|
|
136
|
+
|
|
137
|
+
### destroy()
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
destroy(): void;
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Removes the graph visualization from the DOM and cleans up everything.
|
|
144
|
+
|
|
145
|
+
#### Returns
|
|
146
|
+
|
|
147
|
+
`void`
|
|
148
|
+
|
|
149
|
+
***
|
|
150
|
+
|
|
151
|
+
### fit()
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
fit(nodeIds, zoomOptions?): void;
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Updates pan and zoom to fit the specified nodes in the viewport.
|
|
158
|
+
|
|
159
|
+
#### Parameters
|
|
160
|
+
|
|
161
|
+
| Parameter | Type | Description |
|
|
162
|
+
| ------ | ------ | ------ |
|
|
163
|
+
| `nodeIds` | `string`[] | The ids of the nodes to fit on the screen. Unknown ids are ignored; an empty array (or only unknown ids) does nothing. Pass every id to fit the whole graph. |
|
|
164
|
+
| `zoomOptions?` | [`ZoomOptions`](../type-aliases/ZoomOptions.md) | Specific options on how to transition the zoom. |
|
|
165
|
+
|
|
166
|
+
#### Returns
|
|
167
|
+
|
|
168
|
+
`void`
|
|
169
|
+
|
|
170
|
+
#### Remarks
|
|
171
|
+
|
|
172
|
+
Zoom is limited by [ZoomOptions.minZoom](../type-aliases/ZoomOptions.md#minzoom) / [ZoomOptions.maxZoom](../type-aliases/ZoomOptions.md#maxzoom) and the
|
|
173
|
+
[minZoom](../interfaces/NvlOptions.md#minzoom) / [maxZoom](../interfaces/NvlOptions.md#maxzoom) /
|
|
174
|
+
[allowDynamicMinZoom](../interfaces/NvlOptions.md#allowdynamicminzoom) options. See those for details.
|
|
175
|
+
|
|
176
|
+
#### Example
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
import { NVL } from '@neo4j-nvl/base'
|
|
180
|
+
|
|
181
|
+
const nodes = [{ id: '1' }, { id: '2' }]
|
|
182
|
+
const nvl = new NVL(document.getElementById('frame'), nodes, [])
|
|
183
|
+
|
|
184
|
+
// Fit the whole graph
|
|
185
|
+
nvl.fit(nodes.map((node) => node.id))
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
***
|
|
189
|
+
|
|
190
|
+
### getContainer()
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
getContainer(): HTMLElement;
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Provides the container DOM element the graph is rendered in.
|
|
197
|
+
|
|
198
|
+
#### Returns
|
|
199
|
+
|
|
200
|
+
`HTMLElement`
|
|
201
|
+
|
|
202
|
+
The container element of the NVL instance.
|
|
203
|
+
|
|
204
|
+
***
|
|
205
|
+
|
|
206
|
+
### getCurrentOptions()
|
|
207
|
+
|
|
208
|
+
```ts
|
|
209
|
+
getCurrentOptions(): NvlOptions;
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Returns the current options.
|
|
213
|
+
|
|
214
|
+
#### Returns
|
|
215
|
+
|
|
216
|
+
[`NvlOptions`](../interfaces/NvlOptions.md)
|
|
217
|
+
|
|
218
|
+
The current options.
|
|
219
|
+
|
|
220
|
+
***
|
|
221
|
+
|
|
222
|
+
### getHits()
|
|
223
|
+
|
|
224
|
+
```ts
|
|
225
|
+
getHits(
|
|
226
|
+
evt,
|
|
227
|
+
targets?,
|
|
228
|
+
hitOptions?
|
|
229
|
+
): NvlMouseEvent;
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Gets the nodes, relationships, and clusters that have been hit by a pointer event.
|
|
233
|
+
|
|
234
|
+
#### Parameters
|
|
235
|
+
|
|
236
|
+
| Parameter | Type | Description |
|
|
237
|
+
| ------ | ------ | ------ |
|
|
238
|
+
| `evt` | `MouseEvent` | The mouse event. |
|
|
239
|
+
| `targets` | [`HitTestTarget`](../type-aliases/HitTestTarget.md)[] | The graph elements to check for hits. Defaults to ['node', 'relationship', 'cluster']. |
|
|
240
|
+
| `hitOptions` | \{ `hitNodeMarginWidth`: `number`; \} | Options for the hit test. `hitNodeMarginWidth` widens the node hit area in layout units. |
|
|
241
|
+
| `hitOptions.hitNodeMarginWidth` | `number` | - |
|
|
242
|
+
|
|
243
|
+
#### Returns
|
|
244
|
+
|
|
245
|
+
[`NvlMouseEvent`](../interfaces/NvlMouseEvent.md)
|
|
246
|
+
|
|
247
|
+
A [NvlMouseEvent](../interfaces/NvlMouseEvent.md) with the [HitTargets](../type-aliases/HitTargets.md) property
|
|
248
|
+
containing the nodes, relationships, and clusters that have been hit by the pointer event.
|
|
249
|
+
|
|
250
|
+
#### Remarks
|
|
251
|
+
|
|
252
|
+
Clusters are hit when the pointer is inside a cluster hull, including over its nodes.
|
|
253
|
+
This is the way to react to cluster hover; the hover interaction handler only reports nodes and relationships.
|
|
254
|
+
|
|
255
|
+
#### Example
|
|
256
|
+
|
|
257
|
+
```ts
|
|
258
|
+
import { NVL } from '@neo4j-nvl/base'
|
|
259
|
+
|
|
260
|
+
const container = document.createElement('div')
|
|
261
|
+
const nvl = new NVL(container, [{ id: '0' }], [])
|
|
262
|
+
|
|
263
|
+
// Get the nodes and relationships that have been hit by a pointer event.
|
|
264
|
+
container.addEventListener('click', (evt) => {
|
|
265
|
+
const { nvlTargets } = nvl.getHits(evt)
|
|
266
|
+
console.log('clicked elements:', nvlTargets)
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
// Cluster hover
|
|
270
|
+
container.addEventListener('mousemove', (evt) => {
|
|
271
|
+
const cluster = nvl.getHits(evt, ['cluster']).nvlTargets.clusters[0]?.data
|
|
272
|
+
console.log('hovered cluster:', cluster?.id)
|
|
273
|
+
})
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
***
|
|
277
|
+
|
|
278
|
+
### getImageDataUrl()
|
|
279
|
+
|
|
280
|
+
```ts
|
|
281
|
+
getImageDataUrl(options?): string;
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Returns the current view of the graph visualization canvas as a data URL.
|
|
285
|
+
|
|
286
|
+
#### Parameters
|
|
287
|
+
|
|
288
|
+
| Parameter | Type | Description |
|
|
289
|
+
| ------ | ------ | ------ |
|
|
290
|
+
| `options` | \{ `backgroundColor?`: `string`; \} | The options for the image. |
|
|
291
|
+
| `options.backgroundColor?` | `string` | The background color of the data URL. |
|
|
292
|
+
|
|
293
|
+
#### Returns
|
|
294
|
+
|
|
295
|
+
`string`
|
|
296
|
+
|
|
297
|
+
A data URL of the current view of the graph visualization canvas.
|
|
298
|
+
|
|
299
|
+
***
|
|
300
|
+
|
|
301
|
+
### getNodeById()
|
|
302
|
+
|
|
303
|
+
```ts
|
|
304
|
+
getNodeById(id): Node;
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Returns the node data that is currently stored in the visualisation for a given id.
|
|
308
|
+
|
|
309
|
+
#### Parameters
|
|
310
|
+
|
|
311
|
+
| Parameter | Type | Description |
|
|
312
|
+
| ------ | ------ | ------ |
|
|
313
|
+
| `id` | `string` | The id of the [node](../interfaces/Node.md) that should be returned. |
|
|
314
|
+
|
|
315
|
+
#### Returns
|
|
316
|
+
|
|
317
|
+
[`Node`](../interfaces/Node.md)
|
|
318
|
+
|
|
319
|
+
The [node](../interfaces/Node.md) or undefined if there is no node with the given id.
|
|
320
|
+
|
|
321
|
+
***
|
|
322
|
+
|
|
323
|
+
### getNodePositions()
|
|
324
|
+
|
|
325
|
+
```ts
|
|
326
|
+
getNodePositions(): Node & Point[];
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Fetches and returns the current positions of all nodes as an array of coordinates.
|
|
330
|
+
|
|
331
|
+
#### Returns
|
|
332
|
+
|
|
333
|
+
[`Node`](../interfaces/Node.md) & [`Point`](../interfaces/Point.md)[]
|
|
334
|
+
|
|
335
|
+
An array of [node](../interfaces/Node.md) positions.
|
|
336
|
+
|
|
337
|
+
***
|
|
338
|
+
|
|
339
|
+
### getNodes()
|
|
340
|
+
|
|
341
|
+
```ts
|
|
342
|
+
getNodes(): NodeWithClientPosition[];
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Returns all nodes that is currently stored in the visualisation.
|
|
346
|
+
Each node includes layout coordinates (`x`, `y`) and a `clientPosition` in screen space.
|
|
347
|
+
|
|
348
|
+
#### Returns
|
|
349
|
+
|
|
350
|
+
[`NodeWithClientPosition`](../type-aliases/NodeWithClientPosition.md)[]
|
|
351
|
+
|
|
352
|
+
The array of [nodes](../type-aliases/NodeWithClientPosition.md).
|
|
353
|
+
|
|
354
|
+
***
|
|
355
|
+
|
|
356
|
+
### getNodesOnScreen()
|
|
357
|
+
|
|
358
|
+
```ts
|
|
359
|
+
getNodesOnScreen(): {
|
|
360
|
+
nodes: Node[];
|
|
361
|
+
rels: Relationship[];
|
|
362
|
+
};
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Returns the nodes that are currently in the visualization.
|
|
366
|
+
The `rels` property of the returned object is always empty.
|
|
367
|
+
|
|
368
|
+
#### Returns
|
|
369
|
+
|
|
370
|
+
An object containing the nodes and relationships in the visualization.
|
|
371
|
+
|
|
372
|
+
| Name | Type | Description |
|
|
373
|
+
| ------ | ------ | ------ |
|
|
374
|
+
| `nodes` | [`Node`](../interfaces/Node.md)[] | The nodes in the visualization. |
|
|
375
|
+
| `rels` | [`Relationship`](../interfaces/Relationship.md)[] | The relationships in the visualization. |
|
|
376
|
+
|
|
377
|
+
***
|
|
378
|
+
|
|
379
|
+
### getPan()
|
|
380
|
+
|
|
381
|
+
```ts
|
|
382
|
+
getPan(): Point;
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Returns the current pan of the viewport, in layout coordinates.
|
|
386
|
+
|
|
387
|
+
#### Returns
|
|
388
|
+
|
|
389
|
+
[`Point`](../interfaces/Point.md)
|
|
390
|
+
|
|
391
|
+
The layout-space point shown at the center of the container.
|
|
392
|
+
|
|
393
|
+
#### See
|
|
394
|
+
|
|
395
|
+
[NodeWithClientPosition](../type-aliases/NodeWithClientPosition.md) for the layout-to-screen formula.
|
|
396
|
+
|
|
397
|
+
***
|
|
398
|
+
|
|
399
|
+
### getPositionById()
|
|
400
|
+
|
|
401
|
+
```ts
|
|
402
|
+
getPositionById(id): Node;
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
Returns the node position that is currently stored in the visualisation for a given id.
|
|
406
|
+
|
|
407
|
+
#### Parameters
|
|
408
|
+
|
|
409
|
+
| Parameter | Type | Description |
|
|
410
|
+
| ------ | ------ | ------ |
|
|
411
|
+
| `id` | `string` | The id of the node position that should be returned. |
|
|
412
|
+
|
|
413
|
+
#### Returns
|
|
414
|
+
|
|
415
|
+
[`Node`](../interfaces/Node.md)
|
|
416
|
+
|
|
417
|
+
The position information for the given id, or undefined if there is no such [node](../interfaces/Node.md).
|
|
418
|
+
or the layout has not yet run with that node.
|
|
419
|
+
|
|
420
|
+
***
|
|
421
|
+
|
|
422
|
+
### getRelationshipById()
|
|
423
|
+
|
|
424
|
+
```ts
|
|
425
|
+
getRelationshipById(id): Relationship;
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
Returns the relationship data that is currently stored in the visualisation for a given id.
|
|
429
|
+
|
|
430
|
+
#### Parameters
|
|
431
|
+
|
|
432
|
+
| Parameter | Type | Description |
|
|
433
|
+
| ------ | ------ | ------ |
|
|
434
|
+
| `id` | `string` | The id of the [relationship](../interfaces/Relationship.md) that should be returned. |
|
|
435
|
+
|
|
436
|
+
#### Returns
|
|
437
|
+
|
|
438
|
+
[`Relationship`](../interfaces/Relationship.md)
|
|
439
|
+
|
|
440
|
+
The [relationship](../interfaces/Relationship.md) or undefined if there is no relationship with the given id.
|
|
441
|
+
|
|
442
|
+
***
|
|
443
|
+
|
|
444
|
+
### getRelationships()
|
|
445
|
+
|
|
446
|
+
```ts
|
|
447
|
+
getRelationships(): Relationship[];
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Returns the relationships that are currently in the visualization.
|
|
451
|
+
|
|
452
|
+
#### Returns
|
|
453
|
+
|
|
454
|
+
[`Relationship`](../interfaces/Relationship.md)[]
|
|
455
|
+
|
|
456
|
+
An array of the [relationships](../interfaces/Relationship.md) in the visualization.
|
|
457
|
+
|
|
458
|
+
***
|
|
459
|
+
|
|
460
|
+
### getScale()
|
|
461
|
+
|
|
462
|
+
```ts
|
|
463
|
+
getScale(): number;
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
Get the current zoom level of the viewport.
|
|
467
|
+
|
|
468
|
+
#### Returns
|
|
469
|
+
|
|
470
|
+
`number`
|
|
471
|
+
|
|
472
|
+
The current zoom level.
|
|
473
|
+
|
|
474
|
+
#### See
|
|
475
|
+
|
|
476
|
+
[NodeWithClientPosition](../type-aliases/NodeWithClientPosition.md) for the layout-to-screen formula.
|
|
477
|
+
|
|
478
|
+
***
|
|
479
|
+
|
|
480
|
+
### getSelectedNodes()
|
|
481
|
+
|
|
482
|
+
```ts
|
|
483
|
+
getSelectedNodes(): Node & Point[];
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
Gets the currently selected nodes.
|
|
487
|
+
|
|
488
|
+
#### Returns
|
|
489
|
+
|
|
490
|
+
[`Node`](../interfaces/Node.md) & [`Point`](../interfaces/Point.md)[]
|
|
491
|
+
|
|
492
|
+
An array of all currently selected [nodes](../interfaces/Node.md) and their positions.
|
|
493
|
+
|
|
494
|
+
***
|
|
495
|
+
|
|
496
|
+
### getSelectedRelationships()
|
|
497
|
+
|
|
498
|
+
```ts
|
|
499
|
+
getSelectedRelationships(): Relationship[];
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
Gets the currently selected relationships.
|
|
503
|
+
|
|
504
|
+
#### Returns
|
|
505
|
+
|
|
506
|
+
[`Relationship`](../interfaces/Relationship.md)[]
|
|
507
|
+
|
|
508
|
+
An array of all currently selected [relationships](../interfaces/Relationship.md).
|
|
509
|
+
|
|
510
|
+
***
|
|
511
|
+
|
|
512
|
+
### getSvgDataUrl()
|
|
513
|
+
|
|
514
|
+
```ts
|
|
515
|
+
getSvgDataUrl(options?): Promise<string>;
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
**`Experimental`**
|
|
519
|
+
|
|
520
|
+
Returns the entire graph visualization as an SVG data URL.
|
|
521
|
+
|
|
522
|
+
#### Parameters
|
|
523
|
+
|
|
524
|
+
| Parameter | Type | Description |
|
|
525
|
+
| ------ | ------ | ------ |
|
|
526
|
+
| `options` | \{ `backgroundColor?`: `string`; \} | Options for the SVG export |
|
|
527
|
+
| `options.backgroundColor?` | `string` | The background color of the SVG (defaults to transparent). |
|
|
528
|
+
|
|
529
|
+
#### Returns
|
|
530
|
+
|
|
531
|
+
`Promise`\<`string`\>
|
|
532
|
+
|
|
533
|
+
A Promise resolving to a data URL string representing the graph as SVG (data:image/svg+xml;...)
|
|
534
|
+
|
|
535
|
+
#### Example
|
|
536
|
+
|
|
537
|
+
```ts
|
|
538
|
+
import { NVL } from '@neo4j-nvl/base'
|
|
539
|
+
|
|
540
|
+
const nvl = new NVL(document.getElementById('frame'), [{ id: '0' }], [])
|
|
541
|
+
|
|
542
|
+
const renderSvg = async () => {
|
|
543
|
+
const svgDataUrl = await nvl.getSvgDataUrl({ backgroundColor: '#ffffff' })
|
|
544
|
+
const img = document.createElement('img')
|
|
545
|
+
img.src = svgDataUrl
|
|
546
|
+
document.body.appendChild(img)
|
|
547
|
+
}
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
***
|
|
551
|
+
|
|
552
|
+
### getZoomLimits()
|
|
553
|
+
|
|
554
|
+
```ts
|
|
555
|
+
getZoomLimits(): {
|
|
556
|
+
maxZoom: number;
|
|
557
|
+
minZoom: number;
|
|
558
|
+
};
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
Returns the effective zoom limits.
|
|
562
|
+
|
|
563
|
+
#### Returns
|
|
564
|
+
|
|
565
|
+
The current `minZoom` and `maxZoom`. `minZoom` can be lower than the configured
|
|
566
|
+
option when [NvlOptions.allowDynamicMinZoom](../interfaces/NvlOptions.md#allowdynamicminzoom) let the graph zoom out further.
|
|
567
|
+
|
|
568
|
+
| Name | Type | Description |
|
|
569
|
+
| ------ | ------ | ------ |
|
|
570
|
+
| `maxZoom` | `number` | The highest zoom level the graph can currently reach. |
|
|
571
|
+
| `minZoom` | `number` | The lowest zoom level the graph can currently reach. |
|
|
572
|
+
|
|
573
|
+
***
|
|
574
|
+
|
|
575
|
+
### isLayoutMoving()
|
|
576
|
+
|
|
577
|
+
```ts
|
|
578
|
+
isLayoutMoving(): boolean;
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
Checks and returns whether the current layout is still in flux.
|
|
582
|
+
|
|
583
|
+
#### Returns
|
|
584
|
+
|
|
585
|
+
`boolean`
|
|
586
|
+
|
|
587
|
+
Whether or not the layout is moving.
|
|
588
|
+
|
|
589
|
+
***
|
|
590
|
+
|
|
591
|
+
### pinNode()
|
|
592
|
+
|
|
593
|
+
```ts
|
|
594
|
+
pinNode(nodeId): void;
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
Pins the specified node so it is not affected by layout forces.
|
|
598
|
+
|
|
599
|
+
#### Parameters
|
|
600
|
+
|
|
601
|
+
| Parameter | Type | Description |
|
|
602
|
+
| ------ | ------ | ------ |
|
|
603
|
+
| `nodeId` | `string` | The id of the node to be pinned. |
|
|
604
|
+
|
|
605
|
+
#### Returns
|
|
606
|
+
|
|
607
|
+
`void`
|
|
608
|
+
|
|
609
|
+
***
|
|
610
|
+
|
|
611
|
+
### removeNodesWithIds()
|
|
612
|
+
|
|
613
|
+
```ts
|
|
614
|
+
removeNodesWithIds(nodeIds): void;
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
Removes the specified nodes from the current scene.
|
|
618
|
+
|
|
619
|
+
#### Parameters
|
|
620
|
+
|
|
621
|
+
| Parameter | Type | Description |
|
|
622
|
+
| ------ | ------ | ------ |
|
|
623
|
+
| `nodeIds` | `string`[] | The node ids to be removed. Adjacent relationships will also be removed. |
|
|
624
|
+
|
|
625
|
+
#### Returns
|
|
626
|
+
|
|
627
|
+
`void`
|
|
628
|
+
|
|
629
|
+
***
|
|
630
|
+
|
|
631
|
+
### removeRelationshipsWithIds()
|
|
632
|
+
|
|
633
|
+
```ts
|
|
634
|
+
removeRelationshipsWithIds(relationshipIds): void;
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
Removes the specified relationships from the current scene.
|
|
638
|
+
|
|
639
|
+
#### Parameters
|
|
640
|
+
|
|
641
|
+
| Parameter | Type | Description |
|
|
642
|
+
| ------ | ------ | ------ |
|
|
643
|
+
| `relationshipIds` | `string`[] | The relationship ids to be removed. |
|
|
644
|
+
|
|
645
|
+
#### Returns
|
|
646
|
+
|
|
647
|
+
`void`
|
|
648
|
+
|
|
649
|
+
***
|
|
650
|
+
|
|
651
|
+
### resetZoom()
|
|
652
|
+
|
|
653
|
+
```ts
|
|
654
|
+
resetZoom(): void;
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
Resets the zoom of the viewport back to the default zoom level of 0.75.
|
|
658
|
+
|
|
659
|
+
#### Returns
|
|
660
|
+
|
|
661
|
+
`void`
|
|
662
|
+
|
|
663
|
+
***
|
|
664
|
+
|
|
665
|
+
### restart()
|
|
666
|
+
|
|
667
|
+
```ts
|
|
668
|
+
restart(options?, retainPositions?): void;
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
Restarts the NVL instance.
|
|
672
|
+
|
|
673
|
+
#### Parameters
|
|
674
|
+
|
|
675
|
+
| Parameter | Type | Default value | Description |
|
|
676
|
+
| ------ | ------ | ------ | ------ |
|
|
677
|
+
| `options` | [`NvlOptions`](../interfaces/NvlOptions.md) | `{}` | New [NvlOptions](../interfaces/NvlOptions.md) for the NVL instance. |
|
|
678
|
+
| `retainPositions` | `boolean` | `false` | Whether or not to retain the current node positions. New options will be merged with current options |
|
|
679
|
+
|
|
680
|
+
#### Returns
|
|
681
|
+
|
|
682
|
+
`void`
|
|
683
|
+
|
|
684
|
+
***
|
|
685
|
+
|
|
686
|
+
### saveFullGraphToLargeFile()
|
|
687
|
+
|
|
688
|
+
```ts
|
|
689
|
+
saveFullGraphToLargeFile(options?): void;
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
Saves the entire graph visualization canvas as a png to the client.
|
|
693
|
+
|
|
694
|
+
#### Parameters
|
|
695
|
+
|
|
696
|
+
| Parameter | Type | Description |
|
|
697
|
+
| ------ | ------ | ------ |
|
|
698
|
+
| `options` | \{ `backgroundColor?`: `string`; `filename?`: `string`; \} | The filename and background color of the png. |
|
|
699
|
+
| `options.backgroundColor?` | `string` | The background color of the png file. The size of the png file will be as large as the entire graph at the default zoom level. Can result in a very large file. |
|
|
700
|
+
| `options.filename?` | `string` | The filename of the png file. |
|
|
701
|
+
|
|
702
|
+
#### Returns
|
|
703
|
+
|
|
704
|
+
`void`
|
|
705
|
+
|
|
706
|
+
***
|
|
707
|
+
|
|
708
|
+
### saveToFile()
|
|
709
|
+
|
|
710
|
+
```ts
|
|
711
|
+
saveToFile(options?): void;
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
Saves the current view of the graph visualization canvas as a png to the client.
|
|
715
|
+
|
|
716
|
+
#### Parameters
|
|
717
|
+
|
|
718
|
+
| Parameter | Type | Description |
|
|
719
|
+
| ------ | ------ | ------ |
|
|
720
|
+
| `options` | \{ `backgroundColor?`: `string`; `filename?`: `string`; \} | The filename and background color of the png. |
|
|
721
|
+
| `options.backgroundColor?` | `string` | The background color of the png file. The size of the png file will be the size of the canvas in the DOM. |
|
|
722
|
+
| `options.filename?` | `string` | The filename of the png file. |
|
|
723
|
+
|
|
724
|
+
#### Returns
|
|
725
|
+
|
|
726
|
+
`void`
|
|
727
|
+
|
|
728
|
+
***
|
|
729
|
+
|
|
730
|
+
### saveToSvg()
|
|
731
|
+
|
|
732
|
+
```ts
|
|
733
|
+
saveToSvg(options?): void;
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
**`Experimental`**
|
|
737
|
+
|
|
738
|
+
Saves the entire graph visualization as an SVG file to the client.
|
|
739
|
+
|
|
740
|
+
#### Parameters
|
|
741
|
+
|
|
742
|
+
| Parameter | Type | Description |
|
|
743
|
+
| ------ | ------ | ------ |
|
|
744
|
+
| `options` | \{ `backgroundColor?`: `string`; `filename?`: `string`; \} | Options for the SVG export |
|
|
745
|
+
| `options.backgroundColor?` | `string` | The background color of the SVG file. |
|
|
746
|
+
| `options.filename?` | `string` | The filename of the SVG file. |
|
|
747
|
+
|
|
748
|
+
#### Returns
|
|
749
|
+
|
|
750
|
+
`void`
|
|
751
|
+
|
|
752
|
+
***
|
|
753
|
+
|
|
754
|
+
### setDisableWebGL()
|
|
755
|
+
|
|
756
|
+
```ts
|
|
757
|
+
setDisableWebGL(disabled?): void;
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
**`Experimental`**
|
|
761
|
+
|
|
762
|
+
Restarts NVL with or without WebGL support.
|
|
763
|
+
|
|
764
|
+
#### Parameters
|
|
765
|
+
|
|
766
|
+
| Parameter | Type | Default value | Description |
|
|
767
|
+
| ------ | ------ | ------ | ------ |
|
|
768
|
+
| `disabled` | `boolean` | `false` | Whether or not WebGL should be disabled. |
|
|
769
|
+
|
|
770
|
+
#### Returns
|
|
771
|
+
|
|
772
|
+
`void`
|
|
773
|
+
|
|
774
|
+
***
|
|
775
|
+
|
|
776
|
+
### setLayout()
|
|
777
|
+
|
|
778
|
+
```ts
|
|
779
|
+
setLayout(layout): void;
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
Changes the layout type.
|
|
783
|
+
|
|
784
|
+
#### Parameters
|
|
785
|
+
|
|
786
|
+
| Parameter | Type | Description |
|
|
787
|
+
| ------ | ------ | ------ |
|
|
788
|
+
| `layout` | [`Layout`](../type-aliases/Layout.md) | The [Layout](../type-aliases/Layout.md) type. |
|
|
789
|
+
|
|
790
|
+
#### Returns
|
|
791
|
+
|
|
792
|
+
`void`
|
|
793
|
+
|
|
794
|
+
#### Remarks
|
|
795
|
+
|
|
796
|
+
The layout is re-run only when the type actually changes. Calling this with the
|
|
797
|
+
current layout type is a no-op.
|
|
798
|
+
|
|
799
|
+
***
|
|
800
|
+
|
|
801
|
+
### setLayoutOptions()
|
|
802
|
+
|
|
803
|
+
```ts
|
|
804
|
+
setLayoutOptions(options): void;
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
Updates the configuration of the current layout.
|
|
808
|
+
|
|
809
|
+
#### Parameters
|
|
810
|
+
|
|
811
|
+
| Parameter | Type | Description |
|
|
812
|
+
| ------ | ------ | ------ |
|
|
813
|
+
| `options` | [`LayoutOptions`](../type-aliases/LayoutOptions.md) | The [LayoutOptions](../type-aliases/LayoutOptions.md) configuration. Replaces the previous options. |
|
|
814
|
+
|
|
815
|
+
#### Returns
|
|
816
|
+
|
|
817
|
+
`void`
|
|
818
|
+
|
|
819
|
+
***
|
|
820
|
+
|
|
821
|
+
### setNodePositions()
|
|
822
|
+
|
|
823
|
+
```ts
|
|
824
|
+
setNodePositions(data, updateLayout?): void;
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
Sets the node positions based on data provided.
|
|
828
|
+
|
|
829
|
+
#### Parameters
|
|
830
|
+
|
|
831
|
+
| Parameter | Type | Default value | Description |
|
|
832
|
+
| ------ | ------ | ------ | ------ |
|
|
833
|
+
| `data` | [`Node`](../interfaces/Node.md)[] | `undefined` | The positions that the nodes should be set to. |
|
|
834
|
+
| `updateLayout` | `boolean` | `false` | Whether or not the current layout algorithm should update the graph after setting the node positions. |
|
|
835
|
+
|
|
836
|
+
#### Returns
|
|
837
|
+
|
|
838
|
+
`void`
|
|
839
|
+
|
|
840
|
+
#### Remarks
|
|
841
|
+
|
|
842
|
+
Ids that are not in the graph are skipped with a warning.
|
|
843
|
+
This is the way to position nodes; do not set `x` and `y` on the nodes passed to
|
|
844
|
+
[addAndUpdateElementsInGraph](#addandupdateelementsingraph) or [updateElementsInGraph](#updateelementsingraph).
|
|
845
|
+
For node positions to be unaffected by layout algorithms, use the 'free' layout type
|
|
846
|
+
or use [pinNode](#pinnode) to pin the nodes that should remain still.
|
|
847
|
+
|
|
848
|
+
***
|
|
849
|
+
|
|
850
|
+
### setPan()
|
|
851
|
+
|
|
852
|
+
```ts
|
|
853
|
+
setPan(panX, panY): void;
|
|
854
|
+
```
|
|
855
|
+
|
|
856
|
+
Sets the zoom of the viewport to a specific value.
|
|
857
|
+
|
|
858
|
+
#### Parameters
|
|
859
|
+
|
|
860
|
+
| Parameter | Type | Description |
|
|
861
|
+
| ------ | ------ | ------ |
|
|
862
|
+
| `panX` | `number` | The desired panX value. |
|
|
863
|
+
| `panY` | `number` | The desired panY value. |
|
|
864
|
+
|
|
865
|
+
#### Returns
|
|
866
|
+
|
|
867
|
+
`void`
|
|
868
|
+
|
|
869
|
+
#### Remarks
|
|
870
|
+
|
|
871
|
+
When updating both the zoom level and pan coordinates,
|
|
872
|
+
use [setZoomAndPan](#setzoomandpan) instead of calling [setZoom](#setzoom) and [setPan](#setpan) separately to avoid jittering.
|
|
873
|
+
|
|
874
|
+
***
|
|
875
|
+
|
|
876
|
+
### setRenderer()
|
|
877
|
+
|
|
878
|
+
```ts
|
|
879
|
+
setRenderer(renderer): void;
|
|
880
|
+
```
|
|
881
|
+
|
|
882
|
+
Switches between rendering methods
|
|
883
|
+
|
|
884
|
+
#### Parameters
|
|
885
|
+
|
|
886
|
+
| Parameter | Type | Description |
|
|
887
|
+
| ------ | ------ | ------ |
|
|
888
|
+
| `renderer` | `string` | which rendering method to use |
|
|
889
|
+
|
|
890
|
+
#### Returns
|
|
891
|
+
|
|
892
|
+
`void`
|
|
893
|
+
|
|
894
|
+
***
|
|
895
|
+
|
|
896
|
+
### setZoom()
|
|
897
|
+
|
|
898
|
+
```ts
|
|
899
|
+
setZoom(zoomValue): void;
|
|
900
|
+
```
|
|
901
|
+
|
|
902
|
+
Sets the zoom of the viewport to a specific value.
|
|
903
|
+
|
|
904
|
+
#### Parameters
|
|
905
|
+
|
|
906
|
+
| Parameter | Type | Description |
|
|
907
|
+
| ------ | ------ | ------ |
|
|
908
|
+
| `zoomValue` | `number` | The desired zoom level. |
|
|
909
|
+
|
|
910
|
+
#### Returns
|
|
911
|
+
|
|
912
|
+
`void`
|
|
913
|
+
|
|
914
|
+
#### Remarks
|
|
915
|
+
|
|
916
|
+
When updating both the zoom level and pan coordinates,
|
|
917
|
+
use [setZoomAndPan](#setzoomandpan) instead of calling [setZoom](#setzoom) and [setPan](#setpan)
|
|
918
|
+
separately to avoid jittering.
|
|
919
|
+
|
|
920
|
+
If the zoom level is outside of the range provided by the
|
|
921
|
+
[NvlOptions.minZoom](../interfaces/NvlOptions.md#minzoom) and [NvlOptions.maxZoom](../interfaces/NvlOptions.md#maxzoom) options,
|
|
922
|
+
the zoom level will be set to the closest valid zoom level.
|
|
923
|
+
If [NvlOptions.allowDynamicMinZoom](../interfaces/NvlOptions.md#allowdynamicminzoom) is set to true,
|
|
924
|
+
the [NvlOptions.minZoom](../interfaces/NvlOptions.md#minzoom) option will be ignored of the current graph does not fit the viewport.
|
|
925
|
+
|
|
926
|
+
***
|
|
927
|
+
|
|
928
|
+
### setZoomAndPan()
|
|
929
|
+
|
|
930
|
+
```ts
|
|
931
|
+
setZoomAndPan(
|
|
932
|
+
zoom,
|
|
933
|
+
panX,
|
|
934
|
+
panY
|
|
935
|
+
): void;
|
|
936
|
+
```
|
|
937
|
+
|
|
938
|
+
Sets the zoom and pan of the viewport to specific values.
|
|
939
|
+
|
|
940
|
+
#### Parameters
|
|
941
|
+
|
|
942
|
+
| Parameter | Type | Description |
|
|
943
|
+
| ------ | ------ | ------ |
|
|
944
|
+
| `zoom` | `number` | The desired zoom level. |
|
|
945
|
+
| `panX` | `number` | The desired panX value. |
|
|
946
|
+
| `panY` | `number` | The desired panY value. |
|
|
947
|
+
|
|
948
|
+
#### Returns
|
|
949
|
+
|
|
950
|
+
`void`
|
|
951
|
+
|
|
952
|
+
#### Remarks
|
|
953
|
+
|
|
954
|
+
When only updating zoom level or pan coordinates, use [setZoom](#setzoom) or [setPan](#setpan) instead.
|
|
955
|
+
|
|
956
|
+
If the zoom level is outside of the range provided by the
|
|
957
|
+
[NvlOptions.minZoom](../interfaces/NvlOptions.md#minzoom) and [NvlOptions.maxZoom](../interfaces/NvlOptions.md#maxzoom) options,
|
|
958
|
+
the zoom level will be set to the closest valid zoom level.
|
|
959
|
+
If [NvlOptions.allowDynamicMinZoom](../interfaces/NvlOptions.md#allowdynamicminzoom) is set to true,
|
|
960
|
+
the [NvlOptions.minZoom](../interfaces/NvlOptions.md#minzoom) option will be ignored of the current graph does not fit the viewport.
|
|
961
|
+
|
|
962
|
+
***
|
|
963
|
+
|
|
964
|
+
### unPinNode()
|
|
965
|
+
|
|
966
|
+
```ts
|
|
967
|
+
unPinNode(nodeIds): void;
|
|
968
|
+
```
|
|
969
|
+
|
|
970
|
+
Un-pins the specified nodes so they are affected by layout forces again.
|
|
971
|
+
|
|
972
|
+
#### Parameters
|
|
973
|
+
|
|
974
|
+
| Parameter | Type | Description |
|
|
975
|
+
| ------ | ------ | ------ |
|
|
976
|
+
| `nodeIds` | `string`[] | The ids of the nodes to be un-pinned. |
|
|
977
|
+
|
|
978
|
+
#### Returns
|
|
979
|
+
|
|
980
|
+
`void`
|
|
981
|
+
|
|
982
|
+
#### Remarks
|
|
983
|
+
|
|
984
|
+
A settled force-directed layout does not restart on its own after un-pinning.
|
|
985
|
+
Call [setNodePositions](#setnodepositions) with `updateLayout: true` to wake it up.
|
|
986
|
+
|
|
987
|
+
***
|
|
988
|
+
|
|
989
|
+
### updateElementsInGraph()
|
|
990
|
+
|
|
991
|
+
```ts
|
|
992
|
+
updateElementsInGraph(nodes, relationships): void;
|
|
993
|
+
```
|
|
994
|
+
|
|
995
|
+
Updates relationships in the current scene with the provided array of nodes and relationships.
|
|
996
|
+
|
|
997
|
+
#### Parameters
|
|
998
|
+
|
|
999
|
+
| Parameter | Type | Description |
|
|
1000
|
+
| ------ | ------ | ------ |
|
|
1001
|
+
| `nodes` | \| [`Node`](../interfaces/Node.md)[] \| [`PartialNode`](../type-aliases/PartialNode.md)[] | The updated [nodes](../interfaces/Node.md). |
|
|
1002
|
+
| `relationships` | \| [`Relationship`](../interfaces/Relationship.md)[] \| [`PartialRelationship`](../type-aliases/PartialRelationship.md)[] | The updated [relationships](../interfaces/Relationship.md). Ignores any nodes or relationships that do not exist in the current scene. To update nodes or relationships, they must have an id that matches the id of the node or relationship to be updated. Only the properties that are provided will be updated. If an existing property is not provided, it will not be changed. |
|
|
1003
|
+
|
|
1004
|
+
#### Returns
|
|
1005
|
+
|
|
1006
|
+
`void`
|
|
1007
|
+
|
|
1008
|
+
#### Example
|
|
1009
|
+
|
|
1010
|
+
Updating nodes and relationships
|
|
1011
|
+
```ts
|
|
1012
|
+
import { NVL } from '@neo4j-nvl/base'
|
|
1013
|
+
|
|
1014
|
+
const nodes = [{ id: '1' }, { id: '2' }]
|
|
1015
|
+
const relationships = [{ id: '12', from: '1', to: '2' }]
|
|
1016
|
+
const nvl = new NVL(document.getElementById('frame'), nodes, relationships)
|
|
1017
|
+
|
|
1018
|
+
// Updates an existing node and relationship
|
|
1019
|
+
nvl.updateElementsInGraph([{ id: '1', selected: true }], [{ id: '12', color: '#e0df41' }])
|
|
1020
|
+
```
|