Skip to main content
100%

Basic Bar chart

✓ Published1🌍 Public
AAlina Sul
Last edited Mar 21, 2020
Created on Mar 21, 2020
Forked from Text with d3

This example presents a basic bar chart built with D3 v5 and React, rendering to SVG. The chart displays a static dataset of five values as vertical bars, with bar heights proportional to the numbers. The code defines a 500x500 SVG canvas, applies a padding of 2 pixels between bars, and positions each rectangle using a calculated x coordinate. D3’s data join pattern (selectAll, data, enter, append) creates the rectangles, while attributes like width, height, and y are set via arrow functions derived from the dataset.

AI-generated description

A bare minimum HTML page.

See also React Starter.

MIT Licensed

Similar vizzes