Neo4J Graph Visualization in MyWebApp

243 views
Skip to first unread message

Abhijit Gupta

unread,
Oct 3, 2016, 3:32:47 PM10/3/16
to Neo4j
Hi All,

I am using Neo4J 3.0.6

I want to get the Neo4J Graph Visualization in my application fetching nodes and relationship from Neo4J using Java API as JSON. 

I tried with d3.js (force-directed graph)  but the JSON what I am retrieving is not how d3 requires. Could you please give some pointer on this and which way will be better to get the same kind of visualization.

Warm Regards,
Abhijit

Abhijit Gupta

unread,
Oct 3, 2016, 3:54:56 PM10/3/16
to Neo4j
Bit of more detail on this, 

Java Query to get the JSON data :
----------------------------------
      String relationship = "MATCH (o)-[r:orgEntity_Portfolio]->(p) RETURN o.orgEntityId,p.portfolioId";
      String node = "MATCH (n:portfolios) Return n.portfolioId as portfolioId,n.shortName as shortName";
      
      ExecutionResult  rs = (ExecutionResult )graphDb.execute(node);
      
      Object object = rs.iterator();
      String foo = JsonHelper.createJsonFrom(object);
-----------------------------------

When passing node or relationship parameter in execute, I am getting JSON data as below:

JSON for Node:

{  "innerJavaIterator$1" : [ {    "portfolioId" : 1,    "shortName" : "Single Customer View"  },  {    "portfolioId" : 2,    "shortName" : "BAU"  }]  }

JSON for Relationship

{  "innerJavaIterator$1" : [ {    "p.portfolioId" : 1,    "o.orgEntityId" : 2  } ] }

But problem is I am using d3.js (force-directed graph) which requires Nodes and Links for preparing the chart. Can any one provide some pointer on how to get exact JSON from neo4j so can directly use to prepare the same graph chart in our application.

Thanks in Advance.

Michael Hunger

unread,
Oct 4, 2016, 5:41:49 AM10/4/16
to ne...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Abhijit Gupta

unread,
Oct 4, 2016, 5:59:51 AM10/4/16
to Neo4j
Hi Michael,

Thanks for the link. I checked the link and it shows how we can use different JS and get the graph.

I tried with d3.js (Force Directed Graph), preparing the data from Neo4J DB as json and able to get graph as show below.




I want the look of this should be similar to that of neo4j graph relationship, any pointer on this.

Thanks,
Abhijit
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.

Michael Hunger

unread,
Oct 4, 2016, 6:03:59 AM10/4/16
to ne...@googlegroups.com
It's a bit more involved, see: https://github.com/neo4j/neo4j-browser/blob/2.0/lib/visualization/components/visualization.coffee

I have a repository with a visualization that gets close: http://jexp.github.io/cy2neo


To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscribe@googlegroups.com.

Abhijit Gupta

unread,
Oct 4, 2016, 12:53:17 PM10/4/16
to Neo4j
Thanks for the link Michael.

Regards,
Abhijit

Abhijit Gupta

unread,
Oct 4, 2016, 2:22:18 PM10/4/16
to Neo4j
Michael the link http://jexp.github.io/cy2neo is exactly what I need, but can not download this from GIT. Is there a way to download this for reference and check how it is done.

Regards,
Abhijit

Abhijit Gupta

unread,
Oct 10, 2016, 3:07:40 PM10/10/16
to Neo4j
Hi Michael,

Any pointer for this, as I have to build the same like  http://jexp.github.io/cy2neo . Is there any source for this to study and understand this.

Thanks,
Abhijit
Reply all
Reply to author
Forward
0 new messages