Refining Scales

There are functions for refining the output of a scale. Let's explore what those are.

We are going to look at how to refine our scales. We can change the behavior of a scale by chaining additional functions. Let’s explore what else we can do with scales.

The nice() function

The first function we will explore is called nice(). There are times where our dataset can contain decimal values. We would not always be dealing with whole numbers. Depending on the type of chart we are drawing, it may not be essential to scale a decimal value. We can tell our scale function to round the domain values. That’s what the nice() function does.

We are going to chain the nice() function on the yScale function.

Get hands-on with 1200+ tech skills courses.