Making a Bar Chart
✓ Published1🌍 Public
This example visualizes the top 10 best-selling video games by sales, using a horizontal bar chart. The chart encodes each game’s title on the y-axis and its sales figure on the x-axis, with the data sourced from a CSV file containing 2018 United Nations population estimates. It uses D3 v5 APIs including `scaleLinear` and `scaleBand` for scales, `axisLeft` and `axisBottom` for axes, and SVG `rect` elements for the bars. The code imports functions via ES modules and renders the chart by appending elements to an SVG.
AI-generated descriptionThis 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.
MIT Licensed