Skip to main content
Public

Share visualization

Loading preview…

Rendering Data with React & D3 - CSS colors

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

Rendering Data with React & D3 - CSS colors

1
KKirsten Lund
Last edited Feb 10, 2021
Created on Feb 10, 2021

This example renders the full set of CSS named colors as a circular pie chart, with each color occupying an equal slice. The visualization loads a CSV file from a GitHub Gist using D3’s `csv` utility, then employs D3’s `pie` layout and `arc` path generator to compute the slice geometry. React handles the SVG rendering, mapping each data row to a `<path>` element whose `fill` attribute is set from the `RGB hex value` column. The code demonstrates a clean integration of D3’s data-processing and layout functions with React’s component-based UI.

AI-generated description

Loading data about CSS named colors using D3 utilities plus React to render the data.

<!-- <iframe width="560" height="315" src="https://www.youtube.com/embed/JMvnd1CIRNo" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> -->

Comments

Sign in to join the discussion.

MIT Licensed