neo4jd3 icon indicating copy to clipboard operation
neo4jd3 copied to clipboard

Instead of Getting data from file. How to get it from Neo4j server

Open veerareddyakkili opened this issue 6 years ago • 7 comments

Hi,

I would like to get data from Neo4J server directly when i click on each node. how can i do that.

veerareddyakkili avatar May 31 '18 17:05 veerareddyakkili

First, you need to know the node that has been clicked by implementing either the onNodeClick or onNodeDoubleClick functions when you initialize neo4jd3. Then, inside one of those functions, you can perform an AJAX request to your server and update the graph with the updateWithNeo4jData function.

jesusalber1 avatar May 31 '18 18:05 jesusalber1

if you have sample, can you send me pls

veerareddyakkili avatar May 31 '18 19:05 veerareddyakkili

onNodeClick example Just add the function as another property of the object. Not tested.

jesusalber1 avatar May 31 '18 20:05 jesusalber1

How to get data from Neo4j server initially. is there any way we can do without chnanging the code like using options.neo4jDataUrl.

veerareddyakkili avatar May 31 '18 20:05 veerareddyakkili

Actually by implementing options.onNodeClick you're not changing the code but adding a custom functionality through the options, the core remains the same.

Alternatively, you can use options.neo4jDataUrl (URL to a json) to get your data from the server initially. In any case, if you want to get new data when a node is clicked, you need to implement options.onNodeClick.

If you still have doubts, share some code to help understand what you need exactly.

jesusalber1 avatar Jun 01 '18 08:06 jesusalber1

We want to display all relations first and when we click on relation it has to all the nodes. All this info we should read it from neo4j server.

veerareddyakkili avatar Jun 01 '18 15:06 veerareddyakkili

I'm not sure if you can display a relationship without both startNode and endNode, but I think it's not possible... What you can do instead is to get all the nodes the first time and then use css to hide some of them. In this way, you'll be able to unhide them again easily when clicking the relationship.

jesusalber1 avatar Jun 02 '18 07:06 jesusalber1