Skip to main content
100%

D3 - Function of data

✓ Published1🌍 Public
JJuliaHsu
Last edited Mar 13, 2021
Created on Mar 13, 2021
Forked from Hello d3js

This example demonstrates how D3 binds an array of five objects—each containing a name and score—to SVG circles, using the data to set each circle’s radius and fill color. The code explicitly calls `d3.selectAll('circle').data(scores)` to join the data, then uses anonymous functions within `attr` and `style` to map scores to radii and to alternate green and red fills based on score parity. It also appends a semi-transparent red rectangle to a new SVG via `d3.select('body').append('svg')`. All rendering uses SVG elements and D3 v5 selections.

AI-generated description

An example of modifying DOM selection with D3

MIT Licensed

Similar vizzes