Get introduced to another important scale in D3.js, scaleQuantize.

We'll cover the following

As mentioned in the previous lessons, in linear and logarithmic scales, input and output are both continuous. When the input is continuous, and the output is discrete, we use the scaleQuantize scale.

scaleQuantize is a variant of linear scale, which has discrete output. The input is continuous and is divided into portions specified by values in the range. The mapping is linear, and the output, y, can be expressed in terms of the input, x, through the following function.

y=mx+cy =mx + c


We are going to demonstrate the scaleQuantize function through an example.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy