Skip to content Skip to sidebar Skip to footer

Attach Link To 3d-force-graph Node

Is there a way to attach a link to the nodes in 3d-force-graph (https://github.com/vasturiano/3d-force-graph) so that if a user clicks on a node they are taken away to a specific (

Solution 1:

The answer is found in the .onNodeClick function. For example, add a link to your json:

'nodes': [
    {
    "id": "id1",
    "name": "<h2>Title 1</h2>",
    "val": 1,
    'link': 'test.html?id=1',
    },

And add the following to your graph object:

.onNodeClick(function(node){
    window.location.href = node.link;
})

Post a Comment for "Attach Link To 3d-force-graph Node"