Skip to content

Instantly share code, notes, and snippets.

@robschmuecker
robschmuecker / README.md
Last active January 23, 2024 21:42
Multiple Parent Nodes D3.js

Multi Link Example for http://www.robschmuecker.com/d3-js-drag-and-drop-zoomable-tree/#comment-6190

Added an additional link between nodes at the bottom of the dndTree.js file.

This example pulls together various examples of work with trees in D3.js.

The panning functionality can certainly be improved in my opinion and I would be thrilled to see better solutions contributed.

One can do all manner of housekeeping or server related calls on the drop event to manage a remote tree dataset for example.

@robschmuecker
robschmuecker / README.md
Last active February 25, 2022 16:04
Clickable link Drag and Drop zoomable D3.js tree example.
@robschmuecker
robschmuecker / README.md
Last active January 31, 2024 18:30
Drag and drop, collapsible d3.js Tree with 50,000 nodes

This is an example of a collapsible drag and drop tree implementing slightly modified code from https://gist.github.com/robschmuecker/7880033

This is posted in order to demonstrate a viable answer for a Stack Overflow question http://stackoverflow.com/questions/20539922/has-anyone-produced-a-virtualised-javascript-tree-for-thousands-of-nodes

The only difference between this gist and the one referenced above is that the JSON file has changed. Each node contains 15 children and the depth is 4. Hence over 50,000 nodes.

The performance is fine if not too many of the nodes are present at once in the DOM. The JSON was contructed at http://www.json-generator.com/ with the following markup

@robschmuecker
robschmuecker / README.md
Last active March 12, 2024 05:12
D3.js Drag and Drop, Zoomable, Panning, Collapsible Tree with auto-sizing.

This example pulls together various examples of work with trees in D3.js.

The panning functionality can certainly be improved in my opinion and I would be thrilled to see better solutions contributed.

One can do all manner of housekeeping or server related calls on the drop event to manage a remote tree dataset for example.

Dragging can be performed on any node other than root (flare). Dropping can be done on any node.

Panning can either be done by dragging an empty part of the SVG around or dragging a node towards an edge.