Skip to content

Mark callback? #592

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
j-f1 opened this issue Nov 16, 2021 · 2 comments
Closed

Mark callback? #592

j-f1 opened this issue Nov 16, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@j-f1
Copy link

j-f1 commented Nov 16, 2021

When creating a plot using Observable Plot, I found that using the APIs was a good experience; however, it is essentially impossible to do anything outside of them. It would be nice to have an ”escape hatch” (a customize option callback that takes either a d3 selection or just an HTML node?) in various places to allow for arbitrary customization.

proposal:

Plot.dot(athletes, {
  x: "weight",
  y: "height",
  stroke: "sex",
  customize: el => el.on('mouseenter', (e, d) => alert(d.sport))
}).plot({
  x: {
    customize: el => el.selectAll('.tick').remove()
  },
})
@j-f1 j-f1 changed the title 050678 Escape Hatch Nov 16, 2021
@Fil
Copy link
Contributor

Fil commented Nov 23, 2021

Related: #501 (comment)

@Fil Fil added the enhancement New feature or request label Nov 23, 2021
@Fil Fil changed the title Escape Hatch Mark callback? Nov 23, 2021
@mbostock
Copy link
Member

This description feels too general to be actionable, so I’m going to close, but please continue to share your ideas and perhaps we can rally around something more concrete that we can work on. I also want to note that Plot already has a significant “escape hatch” in the sense that you can provide your own Mark implementation by implementing mark.render or simply by passing a render function in the marks array. This is described here:

https://github.com/observablehq/plot/blob/main/CHANGELOG.md#marks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants