Skip to main content
100%

D3 Example

✓ Published0🌍 Public
CCurran Kelleher
Last edited May 22, 2015
Created on May 14, 2015

This D3 example visualizes the populations of three cities—Shanghai, Buenos Aires, and Mumbai—as a horizontal bar chart. It shows population magnitudes through bar lengths along a linear x-axis, with city names on the ordinal y-axis. The visualization uses D3.js (v3) to load a CSV file, scale data, and render SVG elements. The code employs `d3.scale.linear`, `d3.scale.ordinal`, and `d3.svg.axis` to construct axes, while formatting tick labels with `d3.format("s")` for compact notation. Data comes from the included `geonames_cities_top3.csv` file.

AI-generated description

A standalone D3 horizontal bar chart.

This is example 105 of the screencast Introduction to D3

Similar vizzes