Making a bar chart. Customizing the axis.
✓ Published1🌍 Public
This example shows a horizontal bar chart ranking the ten most populous countries, with each bar’s length representing population in thousands and a customized bottom axis displaying abbreviated tick labels (e.g., “1B” for billions). The chart uses d3.csv to load the data, then applies scaleLinear and scaleBand for positioning, while axisBottom and axisLeft generate the axes. Grid lines are drawn via tickSize(-innerheight), and the axis labels and title are manually added as SVG text elements. The y-axis ticks are stripped of their default lines and domain for a cleaner look.
AI-generated descriptionMIT Licensed