Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Making a Bar Chart

Public visualization

Making a Bar Chart

0 stars0🌍 Public
AAntoaneta
Last edited Nov 12, 2018
Created on Nov 12, 2018

This example demonstrates how to build a simple bar chart showing the 2018 population estimates for the top ten most populous countries, using a dataset from the United Nations World Population Prospects. The visualization initially renders all bars with a fixed width and height of 300 pixels, using D3 v5’s `selectAll` and `data` join to append SVG `rect` elements. The code includes a `scaleLinear` instance that maps a domain of 0 to 100 to a range of 0 to 30, though it is not yet applied to the bar dimensions. The data is loaded from a CSV file and parsed by converting the population string to a number multiplied by 1000.

AI-generated description

This bar chart shows population of the top 10 most populous countries. The data comes from the year 2018 estimate in United Nations: World Population Prospects 2017.

Comments

Sign in to join the discussion.

MIT Licensed