Search⌘ K
AI Features

Understanding Ordinal Scales

Explore how ordinal scales in D3.js transform categorical data, like age groups or survey responses, into ordered color mappings. This lesson helps you understand how to create scalable color assignments for charts with discrete data categories.

We'll cover the following...

We are going to paint each arc a unique color. In the past few projects, we have been assigning custom colors to our images. However, that is not going to cut it for this project. Regardless of how many groups or arcs we have in our pie, each arc should have a unique color. We also want our chart to be scalable.

Let’s say we had more age groups in our data. We would need to generate a new color for each additional group. One option would be to add a color manually. However, that is not scalable. It would be better if our chart could generate a new color for each age group. If we need to add more ...