Skip to main content
100%

Responsive Axes drb

✓ Published0🌍 Public
DDonald Bagwell
Last edited Apr 14, 2024
Created on Apr 14, 2024
Forked from Responsive Axes

This example demonstrates responsive axes that maintain consistent tick mark density as the visualization resizes. The code uses d3.axisBottom and d3.axisLeft, with tick counts dynamically calculated from the inner dimensions divided by a tickDensity value. The axes and labels are placed using scaleLinear scales, and the container size is tracked via a ResizeObserver, which triggers state updates that re-render the visualization. All text is implemented as SVG elements within a D3 selection joined to the parent container.

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