javascriptvue.jsneo4jgraph-databasesgraph-visualization

Unable to get labels for nodes to render using Neo4j visualization library


Following the documentation of the Neo4j Visualization library, I was able to get the graph visualization working easily:

working graph example.

However, I am unable to get the labels/captions to display in the nodes.

I have tried adding the captions following the docs but I am still unable to get the captions to show. I even checked the source code and added captions according to the types declared there but I was still unable to get the captions working. I also tried using the "html" property but that also didn't work.

How to reproduce (minimal example):

JS:

import { NVL } from "@neo4j-nvl/base";

  const nodes = [
    {
      id: "1",
      captions: {
        styles: "bold,italic",
        value: "foo",
        key: "bar",
      },
    },
    { id: "2" },
  ];
  const relationships = [{ id: "12", from: "1", to: "2" }];

  const nvl = new NVL(
    document.getElementById("container"),
    nodes,
    relationships
  );

HTML:

<div id="container" style="height: 20rem" ></div>

Any help on this is much appreciated. Thanks!


Solution

  • I had the same problem. You need to set the renderer to canvas.

    nvlOptions={{
        initialZoom: 1,
        renderer: 'canvas'
    }}
    

    See here Neo4j visualitation Library - (version 0.3.1) Node labels are not visible