Skip to content

Don’t ignore undefined values for ordinal dimensions, and make grouping and faceting consistent? #45

@mbostock

Description

@mbostock

Marks currently ignore data with undefined values. For example, BarX will ignore data whose y, x1 or x2 value is undefined.

const index = filter(I, ...this._positions(channels), F, S);

This is a handy feature for avoiding SVG errors. However, we’re not entirely inconsistent with grouping. I fixed the group1 transform to skip groups whose key is undefined,

return data => groups(data, key).filter(defined1);

but I forgot to fix group2 at the same time. And we don’t apply this same technique to faceting, which is also inconsistent.

I’m now of the opinion that ignoring undefined data for ordinal dimensions — which includes grouping and faceting — is undesirable. Whereas there’s no consistent way to handle undefined data in a quantitative dimension, undefined values don’t have to be specially treated in ordinal dimensions. Furthermore, null and undefined are often used to represent an “other” or “unknown” category with grouping and faceting.

Therefore, I think we should changing the filtering logic and only filter undefined values for quantitative dimensions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn’t working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions