Skip to main content
100%

data join

✓ Published0🌍 Public
HHeet Bhatt
Last edited Jun 23, 2023
Created on Jun 22, 2023

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 description

A demonstration of how to start using D3 version 6.

MIT Licensed

Similar vizzes