May 2019
Beginner to intermediate
650 pages
14h 50m
English
A color palette can be created with an ordinal scale, which maps color schemes to categories. There are 37 color schemes in the d3-scale-chromatic module (version 1). All schemes are functions that are prefixed with d3.scheme*. The following diagram lists the nine categorical schemes:

The following code sets up an ordinal scale with a categorical color scheme, using it to paint the bars from a previous example (see Scales/11.4-category-colors.html). Since there are more data items (20) than colors (10), the colors will repeat:
const colorScale = ...
Read now
Unlock full access