Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Axis Labels

Public visualization

Viewing a saved revision (read-only)

ac7fcf15556c4e0ebfd33820e1052131

Axis Labels

0 stars1🌍 Public
JJacob Chlebowski
Last edited Sep 14, 2024
Created on Sep 14, 2024
Forked from Axis Labels

This example demonstrates how to add clear, readable labels to the X and Y axes of a D3 chart. A gray rectangular plotting area is drawn, with linear scales mapping 0–100 values to pixel coordinates. The X-axis label is positioned below the axis at the horizontal center, while the Y-axis label is rotated 90 degrees and centered vertically. The code uses d3.select, scaleLinear, axisBottom, and axisLeft to construct the visualization, with text elements styled via font-family attributes.

AI-generated description

Credit to @curran

Adding labels to our X and Y axes with D3.