🌍 Public
Viewing a saved revision (read-only)
55a0e4b164b641a38e5e0f40fc18a11f
Making a Bar Chart
This example shows a horizontal bar chart that visualizes the population of various countries, sorted by data order. The chart uses an SVG canvas with a linear scale for population and a band scale for country names, mapping data from a CSV file. The code demonstrates a step-by-step approach to building the visualization, using D3 v5 APIs such as `select`, `scaleLinear`, `scaleBand`, and `csv`. Rectangles are appended to the SVG via the `.enter()` method, with their width and y-position based on the specified scales, and the visualization includes margins that are logged but not fully utilized in the layout.
AI-generated description