🌍 Public
Viewing a saved revision (read-only)
bcc7834f492f4a1e82031295718893df
Basic Bar chart
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 descriptionA bare minimum HTML page.
See also React Starter.