Skip to main content
Public

Share visualization

Loading preview…

Making a barchart

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Making a barchart

1
SShane Carey
Last edited Feb 26, 2019
Created on Aug 30, 2018
Forked from Face in d3

This example shows a horizontal bar chart comparing 2018 population figures across continents, with each bar labeled by continent name and formatted population value. The SVG visualization uses D3 v5 scales—`scaleLinear` for the x-axis population range and `scaleBand` for the y-axis continent categories—with padding to separate bars. Data is parsed from a CSV string in `data.js` using D3’s `csvParse`, and numeric values are cleaned of commas and percentage signs. Rects and text are bound to the data via `selectAll` and `.enter()`, with bar widths scaled against the maximum population.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed