Skip to content

ignore null marks #127

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

Closed
wants to merge 2 commits into from
Closed

ignore null marks #127

wants to merge 2 commits into from

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Feb 16, 2021

Makes it easier to make "toggleable" marks:
Plot.plot({ marks: [ Plot.dot(data), checkbox && Plot.text(data), … ] })

allows to write:
Plot.plot({ marks: [ Plot.dot(data), checkbox && Plot.text(data), … ] })
@Fil Fil requested a review from mbostock February 16, 2021 13:07
@mbostock
Copy link
Member

mbostock commented Feb 16, 2021

Alternatives:

Plot.plot({marks: [Plot.dot(data), ...checkbox ? [Plot.text(data)] : [], ]})
Plot.plot({marks: [Plot.dot(data), checkbox && Plot.text(data), ].filter(x => x)})
Plot.plot({marks: [Plot.dot(data), checkbox ? Plot.text(data) : Plot.none, ]})

@Fil
Copy link
Contributor Author

Fil commented Feb 18, 2021

.filter(x => x) is a bit ugly, but functional.

@Fil Fil closed this Feb 18, 2021
@Fil Fil deleted the ignore-null-marks branch August 12, 2021 07:49
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