Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Making a bar chart

Public visualization

Viewing a saved revision (read-only)

12500c3fc72b4349ab3a52b797ffe128

Making a bar chart

0 stars0🌍 Public
EE.D.M.
Last edited Nov 4, 2019
Created on Oct 31, 2019

This example demonstrates how to build a simple bar chart from a CSV file using D3 v5. The chart displays population data for several countries, with horizontal bars whose widths are proportional to each country’s population. The code uses `d3.csv`, `scaleLinear`, and `scaleBand` to map the data to SVG rectangles, while the rendering is done entirely with SVG elements in an HTML page. The data is loaded from `data.csv` and scaled by a factor of 1000 before being visualized.

AI-generated description

An example showing the capabilities of VizHub.