Skip to main content
Public

Share visualization

Loading preview…

Responsive Axes

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Responsive Axes

0
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

Comments

Sign in to join the discussion.

MIT Licensed