Skip to main content
100%

Data join with array of objects

✓ Published0🌍 Public
663anp3ca
Last edited Sep 7, 2018
Created on Sep 7, 2018

Five city names and population figures from an array of objects render as a horizontal bar chart with steel-blue rectangles and right-aligned labels. The example demonstrates D3’s data join, where each object binds to both a `rect` and a `text` element, using `.data()` and cascading `.attr()` calls. Bar widths scale linearly from the `population` property, while vertical positions derive from the index. A CSS `:hover` rule turns bars orange, and the fixed SVG canvas supplies the static geometry.

AI-generated description

Built with blockbuilder.org

mit Licensed

Similar vizzes