Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Shapes with SVG and CSS

Public visualization

Shapes with SVG and CSS

0 stars0🌍 Public
MMihir Sawant
Last edited Sep 11, 2018
Created on Sep 10, 2018

This example demonstrates how SVG shapes can be styled and colored through a combination of D3.js and CSS. It shows four rectangles arranged in a group, each assigned a distinct fill color from a scaleOrdinal mapping. The code uses D3 v5’s select and scaleOrdinal functions to programmatically apply colors to the rectangle IDs. The SVG elements are defined directly in the HTML, while the styling is applied via JavaScript, with additional CSS rules available for stroke and path properties.

AI-generated description

An example including some commonly used features of SVG.

Comments

Sign in to join the discussion.

MIT Licensed