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

1
ZZhengyan Yu
Last edited Apr 7, 2020
Created on Apr 1, 2020

A horizontal bar chart displays population figures for ten countries, with a steelblue bar for each nation. The example demonstrates a basic D3 data join, using `scaleLinear` for the x-axis and `scaleBand` for the y-axis, with `axisLeft` and `axisBottom` to render the scales. Data loads from a CSV file via `d3.csv`, and the code converts population values to numeric form before rendering the SVG. The chart is built with D3 v5, using a simple selection to append rectangles.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed