Skip to content

Negative values, when rounded to zero, are formatted with a plus sign. #92

@mbostock

Description

@mbostock

For example:

d3.format("+.1%")(-0.0001) // "+0.0%"

This appears to be intentional:

// If a negative value rounds to zero during formatting, treat as positive.
if (valueNegative && +value === 0) valueNegative = false;

But this is pretty confusing, e.g. in this diverging bar chart:

Screen Shot 2020-04-01 at 11 15 23 AM

The code that does this references #42, and it’s not clear whether the fix for formatting -Infinity inadvertently broke formatting for negative near-zero values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions