GithubHelp home page GithubHelp logo

keithpjolley / neo4j2d3 Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 144 KB

import data from neo4j into d3 (or more generally into javascript)

License: MIT License

HTML 5.46% JavaScript 90.83% CSS 3.71%

neo4j2d3's Introduction

neo4j2d3

import data from neo4j into d3 (or more generally into javascript)

i created and shared this to document how i got data from neo4j into javascript and then into d3.

some of it is specific to my case - but really the only thing that should change is how the hierarchy is defined. the slick way to do this would be to use the links info that neo4j returns but my data had specific info embedded into it. each node has an "empno" (employee id), and a "manager_empno" (manager id). my root data has the root node with manager_empno = 0. somewhere in d3 it expects manager_empno to be null.

anyways, figuring out how to get the data into javascript using the ajax call was not all that easy. there's a big difference in how you call neo4j if you use POST or GET.

The data you get back is not at all how d3 expects to see it so a little transmorgification is needed. and some of the d3 demo graphs expect everything to be flat and others as a tree.

both types are done.

here's an example of my data from neo4j:

neo4j-sh (?)$ MATCH path = (n)-[r:Manages*2]->(m) WHERE n.manager_empno=0 RETURN path LIMIT 3;
| path
+-
  [Node[83387]{empno:35596,hire_date:"1991-03-13", name:"Selago, Vladislav",contractor:0,manager_empno:0,depth:0},:Manages[69736]{},
   Node[69738]{empno:14691,hire_date:"1988-08-21",name:"Acieral, Hsuan",contractor:0,manager_empno:35596,depth:1},:Manages[70700]{},
   Node[70702]{empno:16324,hire_date:"1994-11-17",name:"Jabarite, King",contractor:0,manager_empno:14691,depth:2}
  ]
  [Node[83387]{empno:35596,hire_date:"1992-03-02",name:"Selago, Vladislav",contractor:0,manager_empno:0,depth:0},:Manages[69736]{},
   Node[69738]{empno:14691,hire_date:"1989-11-24",name:"Acieral, Hsuan",contractor:0,manager_empno:35596,depth:1},:Manages[83836]{},
   Node[83839]{empno:36115,hire_date:"2009-02-20",name:"Calcispongiae, Rogue",contractor:0,manager_empno:14691,depth:2}
  ]
  [Node[83387]{empno:35596,hire_date:"1999-01-22",name:"Selago, Vladislav",contractor:0,manager_empno:0,depth:0},:Manages[69736]{},
   Node[69738]{empno:14691,hire_date:"2014-07-15",name:"Acieral, Hsuan",contractor:0,manager_empno:35596,depth:1},:Manages[83134]{},
   Node[83136]{empno:35326,hire_date:"2003-03-12",name:"Mimosa, Pat",contractor:0,manager_empno:14691,depth:2}
  ]
+-
3 rows

neo4j2d3's People

Contributors

keithpjolley avatar

Stargazers

Josh avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.