Costumising axes
✓ Published3🌍 Public
This example displays the top 10 most populous countries as a horizontal bar chart, with the x-axis showing population and the y-axis listing country names. The code uses d3.scaleLinear, d3.scaleBand, d3.axisBottom, and d3.axisLeft to construct the scales and axes, while applying a custom tick format that converts large numbers to abbreviated forms like "B". The chart removes default axis domains and tick lines, adds grid lines via tickSize, and renders an SVG with styled text labels. Data is loaded from a CSV file using d3.csv.
AI-generated descriptionMIT Licensed