Skip to content

Aggregated pie charts #2073

Closed
Closed
@alexcjohnson

Description

@alexcjohnson

A common use case for pie charts is like histograms - aggregating all entries for a given label into a single slice, either with an explicit values field or without (then the value is just the count of items). I'm thinking about cases like https://simonbjohnson.github.io/Ebola-3W-Dashboard/ (the two pies in the middle are aggregating row counts by either activity or country) and the canonical "sales by region" pies where each slice is the sum of revenue within some category label.

In principle you can already do this with an aggregate transform, but this seems like a common enough use case (and transforms have enough drawbacks) that both we and our users would benefit from it being built in pie functionality.

Things to consider:

  • I think it's straightforward to do this within the pie type, rather than making a new type (like the distinction between bar and histogram). Does this cause any problems? At least at first that would restrict it to discrete labels, I suppose down the line we could add binning but that'd be a weird thing to do with a pie.
  • arrayOk attributes - do we need to provide eg color redundantly for every item? Do we just take the first value we find? Do we make some way to provide this once per slice, like a distinctlabels attribute and all the arrayOk items just map to that? I think we do NOT want to match the way we (accidentally) did it with histogram where these attributes map to bins (in this case that would mean the distinct labels, in whatever order they might show up)
  • Event data - see Histogram events #2071

cc @etpinard @monfera

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions