Viewing a saved revision (read-only)
Kl3m_vjtq6bQDZ72bXtpu
This example shows a React and D3 interactive scatter plot of five clickable circles loaded from a local CSV file. Clicking a circle highlights it by changing its fill to white and adding a black stroke, using React state to track the selected circle’s ID. The visualization rescales circle positions with `d3.scaleLinear` based on container dimensions tracked by a `ResizeObserver` hook. Rendering is handled imperatively through `d3.select`, `selection.join`, and event listeners, while React manages data loading and state updates.
Rainbow Random Walk
Five colorful circles wander around the canvas with changing direction, bounce off the edges, and softly collide with one another. Their Voronoi cells follow their movement, while the circles pulse and cycle through rainbow hues.
Features
- Randomly steered movement with smooth turns
- Wall bounces and soft circle-to-circle collisions
- Animated Voronoi cells that track the moving circles
- Click a circle to select it
- Responsive full-window canvas
Usage
Open index.html in a browser. The animation starts automatically.