data join
✓ Published0🌍 Public
This example demonstrates the D3 data join pattern by binding an array of city population objects to SVG rectangles and text labels, producing a simple horizontal bar chart. The code uses `select` and `data` from D3 v7, with the `.join` method to create elements for each datapoint. Rectangles are sized proportionally to population via a scale factor, while a separate join on a `.labels` group renders each city’s name. The SVG canvas is fixed at 2000×2000, with five cities hardcoded in the script.
AI-generated descriptionA demonstration of how to start using D3 version 6.
MIT Licensed