Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last threshold's "more than x" label should be "x or more" #78

Closed
robatwilliams opened this issue Jan 18, 2018 · 2 comments
Closed

Last threshold's "more than x" label should be "x or more" #78

robatwilliams opened this issue Jan 18, 2018 · 2 comments

Comments

@robatwilliams
Copy link

Threshold scale domain values indicate the lower bound of every slice except the first. They are inclusive:

var color = d3.scaleThreshold()
    .domain([      0,       1])
    .range(["red", "white", "green"]);

color(-1);   // "red"
color(-0.5); // "red"
color(0);    // "white"
color(0.5);  // "white"
color(1);    // "green"

Given the above scale and .labels(d3.legendHelpers.thresholdLabels), d3-scale will produce the following legend:

RED   Less than 0.0
WHITE 0.0 to 1.0
GREEN More than 1.0

... where the last label being "more than" incorrectly suggests that 1.0 would not be green. In other words, the slice is inclusive but its label is exclusive.

It should say "1.0 or more".

"Less than" at the other end of the scale is correct, because 0 is the upper bound of that slice and is therefore exclusive.

@susielu
Copy link
Owner

susielu commented Feb 7, 2018

Ah that makes sense. I fixed the text in the latest version 2.25.5 it now looks something like this
image

@susielu susielu closed this as completed Feb 7, 2018
@robatwilliams
Copy link
Author

Great to see this fixed in c1bcef8, thanks.

The documentation still needs to be updated though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants