Skip to content

Instantly share code, notes, and snippets.

@shawnbot
Created November 5, 2012 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawnbot/4019603 to your computer and use it in GitHub Desktop.
Save shawnbot/4019603 to your computer and use it in GitHub Desktop.
grab all of the data from d3
// select everything
var data = d3.selectAll("*")
// filter down to nodes with bound data objects
.filter(function(d) { return typeof d === "object"; })
// attach a reference back to the node on each data object
.each(function(d) { d.__node__ = this; })
// return the list of data objects as an array
.data();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment