My version code version is:
const colorScale = d3.scaleThreshold()
.domain(2.6, 75.1)
.range(["#fff", "#000"]);
But the code that works is:
const colorScale = d3.scaleThreshold()
.domain(d3.range(2.6, 75.1, (75.1-2.6)/8)) // can someone explain this line?
.range(["#fff", "#000"]);
I don’t understand what d3.range()
is doing inside .domain()