Skip to content
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

selectFilter #194

Closed
wants to merge 1 commit into from
Closed

selectFilter #194

wants to merge 1 commit into from

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Mar 5, 2021

selectFilter((I, V) => index, {key, ...options})

see discussion at #190 (comment)

=> playground https://observablehq.com/d/c908dd4cadbd9020

related: #138; but it's much more than a filter in the sense that it gets the whole series and can apply, say, ckmeans to do its job.

@Fil Fil requested a review from mbostock March 5, 2021 06:47
@Fil
Copy link
Contributor Author

Fil commented Mar 5, 2021

This could help fix an issue with selectLast etc, which is that they send the last datum of the series even if it's invalid.

using selectFilter((I, V) => I.filter(i => V[i]).slice(-1), {key, ...options}) would give the last valid datum for key

@mbostock
Copy link
Member

mbostock commented Mar 6, 2021

I’d like to try handling this in #193 by changing maybeTransform to check for a filter option (if there is no transform option), and to promote the given filter function of data up to a transform. There could be similar checks for map and sort convenience shorthands, and we’d need to check for this in the Mark constructor, too.

@Fil Fil closed this Mar 6, 2021
@Fil Fil mentioned this pull request Mar 9, 2021
Fil added a commit that referenced this pull request Mar 9, 2021
closes #138
supersedes #194
@Fil Fil mentioned this pull request Mar 9, 2021
mbostock pushed a commit that referenced this pull request Mar 9, 2021
closes #138
supersedes #194
mbostock added a commit that referenced this pull request Mar 9, 2021
* {filter, transform}

closes #138
supersedes #194

* generic sort, filter

* tolerate null

Co-authored-by: Philippe Rivière <[email protected]>
@Fil Fil deleted the selectFilter branch August 23, 2023 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants