Skip to main content
Public

Share visualization

Loading preview…

Make 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

Make a bar chart!

1
ZZihan (Lexie) Zhou
Last edited Mar 6, 2023
Created on Mar 6, 2023

This example shows a horizontal bar chart of population estimates for ten countries, sourced from the World Population Prospects 2017. The chart uses `d3.scaleLinear` for the x-axis and `d3.scaleBand` for the y-axis, with `d3.axisLeft` and `d3.axisBottom` to render ticks. Rectangles are appended to an SVG group after applying the margin convention. Data is loaded from a CSV file and converted to numeric values before rendering.

AI-generated description

Make a bar chart. Data from "World Population Prospects 2017" The topic includes representing a data table in JavaScript, creating rectangles for each row, using linear and band scales, the margin convention and adding axes.

Comments

Sign in to join the discussion.

MIT Licensed