Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Broken out of #1896, this introduces the find reducer which works with the group (or bin) transform to pull out a specific value for each group. This allows the group transform to function as a “pivot wider” transform; for example, it can take “tall” data with a row for each male and female observation and output “wide” data with a column each for male and female observations. This is probably most useful for the difference mark where you want to compare two metrics, but we demonstrate it here using the arrow mark.
To make it easier to implement the find reducer, this PR also enhances the extent supplied to reducers by the bin and group transforms: the extent now includes the (possibly transformed) data. And in the case of the group transform, the extent now includes the group’s x or y value as appropriate.
TODO
Given how close this is to the group transform, I wonder if there is a way to do this without needing to invent a new transform. Like, could there be shorthand for a “find” reducer? Then it could work with the bin transform, too, for example.Done.