Skip to main content
100%

Making a Bar Chart

✓ Published0🌍 Public
YYang Shun Yu
Last edited Sep 15, 2023
Created on Sep 15, 2023
Forked from Hello VizHub

This example produces a bar chart using D3.js, displaying the population of ten countries. D3’s `scaleLinear` maps population values to horizontal bar widths, while `scaleBand` positions each bar vertically by country name, with `bandwidth()` setting bar height. The visualization is rendered as SVG, generated by appending rectangles within an `svg` element. Data is loaded from a local CSV file, with population values converted to numbers before the chart is drawn.

AI-generated description

An example showing the capabilities of VizHub:

  • Loads D3 via UNPKG.
  • Demonstrates use of import from "d3".
  • Demonstrates use of import from local ES6 modules.
MIT Licensed

Similar vizzes