Skip to main content
Public

Share visualization

Loading preview…

Fork of Shapes and Colors with SVG and CSS

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Fork of Shapes and Colors with SVG and CSS

0
謝謝惠喻
Last edited Sep 18, 2023
Created on Sep 18, 2023

This example uses SVG and CSS to draw a single static shape: a yellow circle with a black outline, centered within a 960 by 500 pixel canvas. The underlying JavaScript, built with d3.v7, leverages the `select` and `append` methods from the d3 library to programmatically create the circle. The circle’s radius is set to half the SVG’s height, and its horizontal and vertical positions are calculated from the SVG’s width and height attributes, which are read and converted using `parseFloat`. Styling is applied via the `attr` method for fill color and stroke, resulting in a simple geometric visualization.

AI-generated description

An example including some commonly used features of SVG.

Comments

Sign in to join the discussion.

MIT Licensed