Unlisted
Viewing a saved revision (read-only)
a3974969e11c413ea61b35ec0bf020a8
CCurran Kelleher
Last edited Mar 17, 2025
Created on Mar 17, 2025
Forked from Vanilla D3 Vibecoding Template
View stargazersThis 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 descriptionCircle Selection Example
This is a simple example showing how to:
- Create basic circles in D3.js
- Handle click interactions
- Apply visual feedback to the selected element
How It Works
- 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.