Skip to main content
100%

D3_CookBook(v5)_Ch2 pt2

✓ Published1🌍 Public
JJimMaltby
Last edited Jun 30, 2021
Created on Jun 30, 2021

Three HTML tables display financial transactions, with each table's rows styled differently through D3 selections. The example demonstrates raw DOM selection and manipulation using d3.select and .selectAll("tr") to target table rows, then applying CSS classes like "table-header" and "table-row-odd" based on row index. It shows how to filter row elements via a selection's .select(function(d, i) { ... }) callback, checking an element's position before assigning class attributes. The code adapts older D3 v3 patterns to D3 v5, highlighting changes in how raw selections and element references are handled.

AI-generated description

D3 Cook Book getting used to JS in d3 CH2 Problem in converting from v3 to v5 and looks like book has poor practice of d3.js (https://stackoverflow.com/questions/45181773/d3-js-raw-selection-get-error-uncaught-typeerror-cannot-read-property-0-of-u)

MIT Licensed

Similar vizzes