Skip to main content
100%

Bar Chart I

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Nov 5, 2013

This bar chart visualizes six numeric values—4, 8, 15, 16, 23, and 42—as horizontal bars whose widths are proportional to the data. The chart uses D3 v3’s `d3.scale.linear` to map the domain from zero to the maximum value (42) onto a pixel range of 0–420. Each bar is a styled `div` element with a steelblue background, white text, and a width set via the `style` operator. The code appends these divs using `d3.select` and `.selectAll("div").data(...)`, with the data bound to the DOM. The bars’ labels display the original values.

AI-generated description

A basic HTML bar chart. Part of the Let’s Make a Bar Chart tutorial.

gpl-3.0 Licensed

Similar vizzes