Ordinal Scales

Get introduced to different types of ordinal scales and how they can be implemented D3.js.

We'll cover the following

scaleOrdinal

In this lesson, we will demonstrate another scale in D3.js, the scaleOrdinal, which maps discrete input to discrete output. There will be a one-to-one mapping from a domain to a range, as long as the length of the domain is equal to the length of the range. The range will start repeating itself if the domain’s size is greater than the size of the range. If the number of elements in the range exceeds the number of elements in the domain, all the elements in the domain will be mapped on to the range. The extra elements in the range will be discarded.

See the following example to understand the working of the scaleOrdinal where we convert grades into points out of 10.

Get hands-on with 1200+ tech skills courses.