D3 - Function of data
✓ Published1🌍 Public
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 descriptionAn example of modifying DOM selection with D3
MIT Licensed