Tell us what’s happening:
On this lesson:
I’m just not understanding how this:
const xScale = d3.scaleLinear()
.domain([0, d3.max(dataset, (d) => d[0])])
.range([padding, w - padding]);
can be used like this:
.attr("cx", (d) => xScale(d[0]))
I can see where the information is flowing through, but I can’t understand what makes it connect.
How does it know to pass d
into d3.max
when its called like xScale(d[0])
?
It’s not the variable name is it, that could be anything, but how does it map?
Where can I learn what’s happening here?
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36
.
Challenge: Use a Pre-Defined Scale to Place Elements
Link to the challenge: