Skip to main content
100%

Learn D3 in 5 minutes

✓ Published0🌍 Public
Mmuranjan
Last edited Mar 25, 2020
Created on Mar 25, 2020
Forked from HTML Starter

This example demonstrates the fundamental D3 data-join pattern by binding an array of five numbers to SVG rectangles, with each rectangle's width proportional to its corresponding value. The code selects an SVG container, calls `selectAll('rect')` followed by `.data(data)` and `.enter()`, then appends rects with width attributes set directly from the data. Using D3 v4 and vanilla JavaScript within an HTML page, it renders a simple vertical bar chart where bar heights are fixed by the `barHeight` variable and positioned via `translate` transforms. The visualization serves as a minimal introduction to D3's enter selection and chained attribute methods.

AI-generated description

A bare minimum HTML page.

See also React Starter.

MIT Licensed

Similar vizzes