Skip to main content
100%

Drawing SVG Shapes with D3

✓ Published0🌍 Public
AAnki1997chavan
Last edited Mar 2, 2023
Created on Mar 2, 2023
Forked from HTML Starter

This example contrasts hand-written SVG markup with D3-generated SVG for drawing a simple bar shape. It shows a static green rectangle created directly in HTML using the `<rect>` element, and an identical rectangle produced dynamically via D3’s selection and append methods. The page uses `d3.select`, `append`, `attr`, and `style` to construct and style the SVG node in the DOM. The code relies on D3 v7 loaded from a CDN and does not use any data binding or scales.

AI-generated description

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

See also React Starter.

MIT Licensed

Similar vizzes