InteractionBasic
✓ Published1🌍 Public
This example shows a single SVG rectangle that changes color each time it is clicked. It demonstrates how to attach a basic interaction handler using D3’s `selection.on` method. The code loads D3 v6 from a CDN and renders the rectangle as inline SVG with a fixed size and position. Upon click, the rectangle’s fill is set to a random value from `d3.interpolateRainbow`, cycling through the color spectrum.
AI-generated descriptionA bare minimum HTML page demonstrating use of CSS and JavaScript.
See also React Starter.
MIT Licensed