Skip to content

Aggregation fails to render groups alphabetically preceding all-NULL category #9753

@gah-bo

Description

@gah-bo

Bug Description

When aggregating a field, groups alphabetically prior to a group where the values for the field are all NULL will not render.

In this example, denials in GroupA is always amount=NULL and the categories aaa, charges do not render for that group. Everything works fine for GroupB presumably because denials has at least one non-NULL entry.

{
  "$schema": "https://vega.github.io/schema/vega-lite/v6.json",
  "description": "Bug: categories alphabetically prior to an all-NULL category will not render",
  "data": {
    "values": [
      {"grouping": "GroupA", "type": "aaa", "amount": 100},
      {"grouping": "GroupA", "type": "charges", "amount": 100},
      {"grouping": "GroupA", "type": "denials", "amount": null},
      {"grouping": "GroupA", "type": "denials", "amount": null},
      {"grouping": "GroupA", "type": "yyy", "amount": 100},
      {"grouping": "GroupA", "type": "zzz", "amount": 100},
      {"grouping": "GroupB", "type": "aaa", "amount": 100},
      {"grouping": "GroupB", "type": "charges", "amount": 100},
      {"grouping": "GroupB", "type": "denials", "amount": 100},
      {"grouping": "GroupB", "type": "denials", "amount": null},
      {"grouping": "GroupB", "type": "yyy", "amount": 100},
      {"grouping": "GroupB", "type": "zzz", "amount": 100}
    ]
  },
  "mark": {"type": "bar"},
  "encoding": {
    "x": {
      "field": "grouping",
      "type": "nominal",
      "title": "Group"
    },
    "y": {
      "aggregate": "sum",
      "field": "amount",
      "type": "quantitative",
      "title": "Sum of Amount"
    },
    "color": {
      "field": "type",
      "type": "nominal"
    }
  }
}

Vega-Editor.

  • I checked for duplicate issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🐛Help WantedGood tasks for contributors (try https://github.com/vega/vega-lite/issues/1486 first)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions