observablehq / observablehq/plot

Optional `id` property for marks

Open
#1,076 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
HTML
Stars
5.4k
Forks
244
PR merge metrics
No merged PRs in 30d

Description

As already discussed in #66 by @Fil I would also like to have the possibility to add an optional id property to marks mapping to SVG id. This would allow external JavaScript to interact with the chart, like for example Tippy.js for more advanced tooltips.

I think the user would just via documentation have to be made aware of the fact that the ID needs to be unique for the plot and the page as a whole. (Possibly Plot could help with this and optionally prefix the IDs with some ID unique to the chart?)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how mark mappings become SVG attributes and review the documentation for mark options. The change is complete when a mark can optionally produce the requested SVG id, the uniqueness requirement is documented, and external JavaScript can target it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.