...

/

The ‘scaleThreshold()’ Scale

The ‘scaleThreshold()’ Scale

The threshold scale allows developers to configure how a continuous dataset is mapped to a discrete dataset.

We are going to be exploring one more scale called the threshold scale. The threshold scale is more customizable than the previous three scales we have been using. Up until now, D3 has done the work for calculating how big a bucket is. It did not let us set the size of a bucket. The threshold scale allows us to configure how data is distributed. Let’s explore how the threshold scale works.

How a threshold scale works

The threshold scale will transform continuous data into discrete data. It is the same as the quantize and quantile scales. We are going to be using this scale to transform the data into three colors. The colors will again be white, pink, and red.

Before we proceed further, we should discuss what the word threshold means. A threshold is a level, rate, or amount at which something comes into effect.

Thresholds ...

Access this course and 1400+ top-rated courses and projects.