Skip to main content
100%

D3 selection examples (exploring phases)

✓ Published0🌍 Public
MMarta
Last edited Sep 27, 2024
Created on Sep 27, 2024

This example demonstrates dynamic data joins in D3 with animated circles whose count, position, and radius oscillate over time. It shows both a commented-out manual `selection.data()`, `enter()`, `append()`, `merge()`, and `exit()` workflow, alongside the active `selection.join()` shorthand which automatically handles entering and exiting elements. The animation runs on a 60fps `setInterval` using `Math.sin` to generate periodic values. It renders SVG circles sized and offset by each datum’s cosine-based properties, updating every frame. The code uses D3 v7’s `select` and `range` from the `d3` package.

AI-generated description

Trying to learn how this thing works.

ISC Licensed

Similar vizzes