Making a bar chart
This example shows a bar chart of country populations, with each bar’s width mapped to population size using a d3.scaleLinear domain from zero to the maximum value. The chart renders as SVG rectangles appended to a 960×500 pixel container, though bar dimensions are fixed at 300×300 pixels regardless of data. The code loads data from a CSV file via d3.csv, parses the population column by multiplying it by 1000, and uses d3.select, d3.max, and d3.scaleLinear from D3 v5.