Rectangles data Color Jason
This example visualizes a small hardcoded dataset of seven rectangles, each with explicit position, size, color, and a text label. The visualization shows the rectangles as colored SVG shapes with black outlines, while each rectangle is paired with its name displayed to its right in monospace font. The code uses D3 v4 to bind the JSON data array to SVG `<rect>` and `<text>` elements via `d3.selectAll().data().enter().append()`. It sets position and size attributes directly from the data properties, fills each rectangle with its specified color string, and positions the labels by offsetting from each rectangle’s coordinates. The rendering approach is plain SVG appended to the body, with styling applied inline through D3’s `.attr` and `.style` methods.
AI-generated descriptionBuilt with blockbuilder.org
forked from <a href='http://bl.ocks.org/Igathi/'>Igathi</a>'s block: <a href='http://bl.ocks.org/Igathi/713b5a2deed36e1f2a153d7a303d8279'>Rectangles using data</a>
forked from <a href='http://bl.ocks.org/Igathi/'>Igathi</a>'s block: <a href='http://bl.ocks.org/Igathi/c7f786a4f651020d22bc1b0c056a4b4d'>Rectangles using data Color</a>