Skip to main content
100%

Corey's Responsive Axis

✓ Published1🌍 Public
Ccoreyfnolan@gmail.com
Last edited Apr 17, 2024
Created on Feb 11, 2024
Forked from Axis Labels

This example demonstrates a D3.js visualization with labeled X and Y axes that adapt their tick density based on the chart's dimensions. It shows how a ResizeObserver monitors the container, and when resized, the axes recalculate tick counts relative to the inner plot area's width and height. The code uses d3.scaleLinear for the x and y scales, d3.axisBottom and d3.axisLeft to render the axes, and custom functions for the axis labels. A gray inner rectangle marks the plot region, with the axes positioned along its bottom and left edges.

AI-generated description

Adding labels to our X and Y axes with D3.

MIT Licensed

Similar vizzes