...

/

The ‘scaleQuantize()’ Scale

The ‘scaleQuantize()’ Scale

Quantize scales allow for continuous data to be transformed into a discrete dataset with equal intervals.

We are going to learn about a scale called the quantize scale. Sounds scary, but I promise you it is not. Let’s talk about the problem we faced in the previous lecture.

The problem with a linear scale

We needed to transform our values into colors. We used the linear scale to accomplish this. The linear scale will transform the dataset from a continuous dataset to another continuous dataset. In our case, the output will be a continuous dataset of colors. While it is great that D3 could handle this without a problem, it was difficult to read the data. We had 100 different colors in the chart.

Rather than having 100 different colors, we should limit how many colors can be used. In other words, we should transform the data into a discrete dataset. As a reminder, data that is discrete means there are a limited number of choices. We should be able to count how many values are in a dataset if it is discrete.

The quantize scale is a scale that can transform continuous data into discrete data. It is the solution that can ...

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