To create a line, we use the d3.line() generator and define the x- and y-accessor functions. Accessors tell the generator how to read the x and y coordinates from data points.
We begin by defining two scales. If you remember from Chapter 1, Getting Started with D3, ES2017, and Node.js, scales are functions that map from a domain to a range; we'll talk more about them in the next chapter:
const x = d3.scaleLinear() .range([ 0, (chart.width / 2) ...