...

/

Refining the Axis Ticks

Refining the Axis Ticks

We can change how ticks on an axis are distributed and formatted if we don't like the default behavior of D3.

We'll cover the following...

We are going to make one final adjustment to the scatter plot before we consider it complete. Let’s look at the x-axis for a moment.

There are two problems with it. The first problem is there are too many tick marks. Fewer tick marks would make it easier to read.

The second problem is the labels for the ticks. If you were to view the weather in most weather apps, the humidity is displayed as a percentage. The dataset stores the humidity as a number between 0 and 1. We are currently seeing decimal values. We will need to convert this into a percentage. Let’s tackle both problems.

Configuring the axis ticks

First, we will reduce the number of ticks drawn by the axis. We are going to modify the xAxis ...