-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
find reducer #1914
Merged
Merged
find reducer #1914
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mbostock
force-pushed
the
mbostock/find
branch
from
November 1, 2023 22:41
82bc00b
to
9611663
Compare
Fil
approved these changes
Nov 2, 2023
This was referenced Nov 2, 2023
chaichontat
pushed a commit
to chaichontat/plot
that referenced
this pull request
Jan 14, 2024
* find transform * find reducer * prefilter data * extent * find documentation --------- Co-authored-by: Philippe Rivière <fil@rezo.net>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.