color = {
const thresholds = [0, 1, 2, 3, 4, 5];
const positive = d3
.scaleThreshold()
.domain(thresholds)
.range(d3.schemeGreens[thresholds.length + 1]);
const negative = d3
.scaleThreshold()
.domain(thresholds)
.range(d3.schemeOranges[thresholds.length + 1]);
return (x) =>
x === undefined
? "transparent"
: x >= 0
? positive(x)
: negative(Math.abs(x));
}