Skip to main content
100%

rectangles using d3

✓ Published1🌍 Public
HHeet Bhatt
Last edited Jun 22, 2023
Created on Jun 22, 2023
Forked from data join in d3

Five rectangles are displayed in an SVG canvas. The rectangles are initially unstyled, and user interaction changes their fill color: clicking turns a rectangle orange, mouseover turns it green, and mouseenter turns it white. The code uses D3 v7's `selectAll` and `select` functions to bind event listeners and set attributes like width, height, x, and y. Positioning is computed with a conditional expression that alternates the horizontal offset based on each rectangle's index.

AI-generated description

A demonstration of how to start using D3 version 6.

MIT Licensed

Similar vizzes