Skip to main content
Public

Share visualization

Loading preview…

Customizing axis in D3.js

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Customizing axis in D3.js

1
Ggorfoula
Last edited Jul 16, 2020
Created on Jul 14, 2020

This example demonstrates how to customize the axes of a bar chart in D3.js, visualizing the populations of the 11 most populous countries. The chart uses a linear scale for the population axis and a band scale for country names, with grid lines and formatted tick labels. Custom styling is applied through CSS classes, and the y-axis domain and tick lines are removed. The code imports functions like `scaleLinear`, `scaleBand`, `axisBottom`, and `axisLeft` from D3, and uses `csv` to load data from `data.csv` and `svg` to render the result as an SVG element.

AI-generated description

A bare minimum HTML page.

See also React Starter.

Comments

Sign in to join the discussion.

MIT Licensed