Skip to main content
100%

D3 Colors

✓ Published0🌍 Public
WWilliamQLiu
Last edited Nov 18, 2014
Created on Nov 18, 2014

This example demonstrates how D3’s color utilities can define and manipulate colors, then apply them to a simple bar chart. It first creates a color value using d3.rgb, d3.hsl, d3.hcl, and d3.lab, and uses it to set the page’s background. The main visualization renders 20 vertical bars across the full window width, with each bar’s fill assigned from the built-in d3.scale.category20c color palette. The code relies on D3 v3’s SVG selection and data-join methods, mapping a d3.range dataset to rect elements.

AI-generated description

Similar vizzes