Legend setting issue

Dear all,
I was trying to wrtie legend code, one trial of it is like follows:
(1) the color scheme, as you can see, the domain is from 0 to 0
color = d3.scaleLinear()
.domain([0, 0])
.range(["#F0F0F0", “#a6172d”])
(2) the legend
legendPercentage = legend({
color: colorCountry2, colorInterpolator,
title: ‘Annual AA articles published on WoS’,
tickFormat: s => ${d3.format('0.3f')(s/*100)}%,
})

Since the domain is from 0 to 0, the legend is shown as follows:
image
Thus I was wondering why the 0.000% was not at the left position (#F0F0F0), but appears at the middle? And how to make it start from the left position?

Thank you very much for you time!

See Use midpoint of range with collapsed domains? · Issue #117 · d3/d3-scale · GitHub

1 Like

Thank you very much!