Skip to main content
Unlisted

Share visualization

Loading preview…

Fork of D3 AI Template

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

Anyone with the link can view this unlisted visualization. Posting it publicly will make the link discoverable.

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

Fork of D3 AI Template

0 stars0
CCurran Kelleher
Last edited Mar 17, 2025
Created on Mar 17, 2025
View stargazers

This example demonstrates interactive circle selection in a responsive visualization. Five colored circles are positioned in a grid pattern that adapts to the viewport size. Clicking a circle toggles a black border selection state, managed through React state. The visualization uses D3.js for SVG rendering and data joins, while a ResizeObserver monitors container dimensions to update the layout on window resizing. Circles animate their positions smoothly via CSS transitions on the `cx` and `cy` attributes.

AI-generated description

Responsive Circle Selection Example

This is a responsive visualization showing how to:

  1. Create basic circles in D3.js that adapt to viewport size
  2. Handle click interactions
  3. Apply visual feedback to the selected element
  4. Use ResizeObserver to react to container size changes

How It Works

  • Circles automatically position themselves across the viewport
  • The visualization adapts when the browser window is resized
  • Click on any circle to select it
  • Click on a selected circle to deselect it
  • Selected circles have a black border

This is a great starter template for more complex interactive visualizations.

Comments

Sign in to join the discussion.

MIT Licensed