Skip to main content
100%

Responsive Axes

✓ Published1🌍 Public
DDonald Bagwell
Last edited Apr 14, 2024
Created on Apr 10, 2024
Forked from Axis Labels

This example demonstrates responsive axes that adapt to a container’s changing dimensions using a ResizeObserver. The visualization shows a gray plot area with labeled x and y axes, where tick counts automatically adjust based on the inner width and height. The code builds on D3 v7, using `scaleLinear` for coordinate mapping, `axisBottom` and `axisLeft` for axis rendering, and modular functions imported from separate files to organize scales, labels, and axis components. The `observeResize` module triggers re-rendering whenever the container size changes.

AI-generated description

Creating circles with D3.

Challenge

  • Fork this example
  • Modify it
  • Maybe make it Halloween themed
  • Maybe make it Christmas themed
  • Be creative
MIT Licensed

Similar vizzes