Skip to main content
100%

InteractionBasic

✓ Published1🌍 Public
Vvivianaaai@qq.com
Last edited Nov 7, 2023
Created on Nov 7, 2023
Forked from D3.js 教程

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 description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter.

MIT Licensed

Similar vizzes