Formatting

D3 comes with functions for formatting data. It can handle all types of values from numeric to time.

Let’s update the tooltip with information about the dot the reader is hovering over. We will be working on the callback function we have written for the mouseenter event. In our function, we are provided an argument called datum. There are three things we need to grab. They are the date, humidity, and temperature. These properties are available in this argument.

Rendering the data

Let’s load these properties in the appropriate location in the tooltip. After moving the tooltip, we will use the tooltip selection to select the respective locations.

Get hands-on with 1200+ tech skills courses.