Skip to main content
100%

Responsive Axes

✓ Published0🌍 Public
Ppbruss@bu.edu
Last edited Oct 24, 2024
Created on Oct 24, 2024
Forked from Responsive Axes

This visualization demonstrates responsive axes that maintain consistent tick mark density when the chart is resized. Using D3.js, the example calculates the number of ticks based on the inner width and height divided by a constant tick density value, ensuring an even distribution regardless of the container dimensions. A ResizeObserver monitors the container's size, triggering the scales and axes to update dynamically in full-screen mode. The `axisBottom` and `axisLeft` functions render the axes with labels, all within a nested SVG joined via D3's selection API.

AI-generated description

A viz container with responsive axes that have consistent tick mark density. Try opening in full screen mode and resizing!

Challenge

  • Use this technique to make the axes on your viz responsive
MIT Licensed

Similar vizzes