Skip to main content
100%

D3 Adapter for JS Arrays

✓ Published0🌍 Public
GGordonSmith
Last edited Oct 31, 2015
Created on Oct 31, 2015

This example demonstrates a custom D3 adapter that lets D3 selection operations manipulate plain JavaScript arrays as if they were DOM nodes. Using d3.select and d3.selectAll, the code joins two arrays, logging enter, update, and exit events, then reorders elements and removes matches. It also appends paragraph elements to the body, showing how the adapter bridges array data with standard D3 rendering. The adapter implements createElement, querySelectorAll, appendChild, insertBefore, and removeChild to mimic a minimal document tree, enabling D3’s data join and order methods to directly modify array contents.

AI-generated description

POC of a JS Array Adapter which enables d3 selections to amend its content.

Similar vizzes