Skip to main content
100%

Customizing Bar Chart Axis

✓ Published1🌍 Public
Fframptonb
Last edited Feb 14, 2023
Created on Feb 11, 2023

This example demonstrates how to customize bar chart axes using D3.js (v5), presenting population data for ten countries from a CSV file. The chart uses a linear scale for the x-axis, showing population values, and a band scale for the y-axis listing countries. The code extends the `d3.axisBottom` and `d3.axisLeft` functions, applying a custom tick formatter that converts numbers to abbreviated labels (e.g., "B" for billion) and removing domain lines and tick marks for a cleaner look. SVG rendering displays the bars, with styled tick text and lines via CSS.

AI-generated description

Demonstrates fundamental DOM manipulation using D3.js by producing a bar chart from data within a csv file. (based on forked code from Curran Kelleher)

MIT Licensed

Similar vizzes