Skip to main content
Public

Share visualization

Loading preview…

Making a bar chart

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 bar chart

2
SSamuel Elbaz
Last edited Oct 28, 2019
Created on Oct 28, 2019
Forked from Making a bar chart

This example displays a horizontal bar chart of country populations, sourced from a CSV file and rendered as an SVG. The D3.js library maps population values to bar lengths using a linear scale, while country names define the categorical axis. Explicitly coded axis generators, `axisLeft` and `axisBottom`, place labels for interpretation. The bars are drawn by appending `rect` elements, whose width is derived from the scaled population data, and the visualization is styled with steelblue fills, as seen in the accompanying CSS.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed