how can i get properties of clicked node with neovis

1.4k views Asked by At

I am using the neo4j graph database and I am using neovis.js to visualize my graph.I visualized the graph but I can't get the info of the clicked node. How can I get properties of a clicked node with neovis.js?

3

There are 3 answers

4
Thennan On

You can view the properties of a node by hovering your cursor over the node.
Clicking of any sort in neovis is used to modify the visualization. Hover node for Node details

0
lanny8588 On

you can do like this,add a click event(https://github.com/neo4j-contrib/neovis.js/issues/16)

viz = new NeoVis.default(config);
viz.render();

viz.registerOnEvent("completed", (e)=>{
    viz["_network"].on("click", (event)=>{
        console.log($('.vis-tooltip').text()); //get node properties
    });
});
1
Nao Ito On

Is this enough for your usecase?

viz.registerOnEvent('clickNode', (e) => {
  // e: { nodeId: number; node: Node }
  console.info(e.node.raw.properties);
});