Skip to main content
Public

Share visualization

Loading preview…

Another fork of 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

Another fork of responsive axes

0
Ccoreyfnolan@gmail.com
Last edited Mar 28, 2024
Created on Mar 28, 2024
Forked from Responsive Axes

This example demonstrates a data visualization with responsive axes that maintain consistent tick mark density as the viewport resizes. The chart displays a simple, abstract dataset within a gray inner rectangle, featuring labeled X and Y axes. The core behavior is achieved by using a ResizeObserver to track container dimensions, which then dynamically recalculates the number of axis ticks based on the available inner width and height. The implementation relies on D3.js functions like `scaleLinear`, `axisBottom`, `axisLeft`, and custom modules for axis and label rendering, ensuring the tick spacing remains visually uniform across different screen sizes.

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