Skip to main content
100%

d3.create + selection.adopt

✓ Published0🌍 Public
Mmbostock
Last edited Nov 14, 2011
Created on Nov 14, 2011

This example demonstrates two new D3 API methods, `d3.create` and `selection.adopt`, through their source code diffs. `d3.create` constructs a new element (namespaced or not) and wraps it in a selection, while `selection.adopt` moves existing nodes from another selection into the current context by appending them as children. The diff also shows changes to `selection.select` and `selection.selectAll` to pass the group index as a third argument to the selector callback, enabling hierarchical context for these operations. The code is written against the core `d3.selection` prototype and uses standard DOM methods like `document.createElementNS` and `appendChild`.

AI-generated description

Similar vizzes