Skip to content

selectFilter - #194

Closed
Fil wants to merge 1 commit into
mainfrom
selectFilter
Closed

Fil wants to merge 1 commit into
mainfrom
selectFilter

Conversation

@Fil

@Fil Fil commented Mar 5, 2021

Copy link
Copy Markdown
Contributor

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

Fil commented Mar 5, 2021

Copy link
Copy Markdown
Contributor Author

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

mbostock commented Mar 6, 2021

Copy link
Copy Markdown
Member

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 <fil@rezo.net>
@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