Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Make a Bar Chart with SVG and CSS

Public visualization

Viewing a saved revision (read-only)

985f5dd501894450ac3d2c41ec9b0c6d

Make a Bar Chart with SVG and CSS

0 stars0🌍 Public
NNewSage-01
Last edited Dec 26, 2019
Created on Dec 22, 2019

This example shows a horizontal bar chart of country populations, with bars extending from left to right, using data from a CSV file. The visualization renders as an SVG graphic, where the bar lengths represent population values and the y-axis positions correspond to country names. The code imports D3 v5 functions like `scaleLinear`, `scaleBand`, and `csv` from the 'd3' module, and builds the chart by appending rectangle elements to the SVG. Population values are multiplied by 1000 in the data preprocessing step.

AI-generated description