Skip to content

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

@robatwilliams

Description

@robatwilliams

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions