Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Axis Labels

Public visualization

Viewing a saved revision (read-only)

20e65eaca13d45b88d199f298a8311de

Fork of Axis Labels

0 stars0🌍 Public
AAzhar Harisandi
Last edited Dec 26, 2024
Created on Dec 26, 2024
Forked from Axis Labels

This example demonstrates how to add labels to both axes of a scatterplot-style visualization using D3. The code constructs a simple chart with a gray inner rectangle, linear scales, and bottom and left axes, then appends rotated and centered text labels for the X and Y axes. It uses modular functions like `xAxisLabel` and `yAxisLabel` to position the labels with configurable offsets. The implementation relies on D3’s `scaleLinear`, `axisBottom`, and `axisLeft` APIs, with a ResizeObserver to handle responsive sizing.

AI-generated description

Adding labels to our X and Y axes with D3.