d3.layout.force3D
d3.layout.force3D copied to clipboard
D3 plugin extending d3.layout.force to the third dimention in a proper way
##d3.layout.force3D with a proper third dimension
Import it to your project after d3.js and replace:
d3.layout.force() with d3.layout.force3D() into your code.
Original API is unchanged except for:
size()that now takes an array of length 3 instead of 2. Default is now.size([1, 1, 1]).force.dragis not really supported because of the third dimention. You have to implement it yourself with unprojection techniques. The currentminimal-dirty-example.htmldemo drag only on thexandyaxes and ignore thezaxis.
Demo
cljs-gravity, implemented in ClojureScript with d3.layout.force3D running in a distinct webworker.
Example
You can find dirty but working minimal code here.
###Credits
Adapted from:
- original D3.js code,
- @kalenedrael's smart ideas and work.
I just extracted it, rewrote it, and exported it as a d3 plugin. So please give him the credits ;)