Skip to main content
Public

Share visualization

Loading preview…

D3 Selection Exploration (Exit Selection Effect)

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

D3 Selection Exploration (Exit Selection Effect)

0
Nnim@brejnholt.dk
Last edited Jan 24, 2024
Created on Jan 24, 2024

This example demonstrates D3’s exit selection effect by animating a fluctuating number of circles that move along sine-wave paths. Using `d3.select`, `d3.range`, and a `setInterval` loop, it updates the data array each frame, then merges newly entered circles with existing ones via `.enter()` and `.merge()`, while `.exit().remove()` instantly deletes circles that no longer have corresponding data. The visualization uses an SVG rendering with dynamic `cx` and `cy` attributes, showing how D3 manages DOM elements for changing data sizes without transitions.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed