Programmatically assigning/clearing the pointer (tip) value
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- data-visualization
Direzione di ricerca
Inizia esaminando il comportamento esistente dell’interazione tra puntatore e tip, incluso il modo in cui ogni istanza di Plot tiene traccia del proprio stato del tip ed espone il valore indicato. Confronta le API proposte plot.value, mark.point/pointIndex e mark.tip.point; il lavoro è completato quando viene selezionata un’API supportata che possa assegnare o cancellare i puntatori tra plot separati senza una selezione dei dati ambigua.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I have a set of plots (effectively small multiples) but they are generated with separate instances of Plot.plot. These plots have a tip, and I would like to ensure that at most one tip is visible at a time across plots. Since Plot tracks the tip state within each rendered plot separately, if I do nothing then I can click on each plot to make the tip sticky, and end up with many simultaneously visible tips. This is especially noticeable on mobile when it often occurs unintentionally (because tips are effectively sticky by default and are hard to clear).
I can clear the tip programmatically like so:
plot.dispatchEvent(new PointerEvent("pointerdown", {pointerType: "mouse", bubbles: true}));
But, I thought it would be nicer if there were a more discoverable and supported API. Here are a few possibilities I’m considering.
1. Assigning plot.value
plot.value = null;
This would be symmetric to getting the pointed value, which is appealing. But I think it’s too ambiguous for setting it: you’d need to set it to the exact datum, which wouldn’t work in many cases when the data is not unique. Plus you could have multiple marks with pointer interactions — maybe you want to control them independently, or at least maybe they each need different hints to know what should be pointed.
2. A mark.point method
mark.point(value);
mark.pointIndex(index); // or if an index is preferred
If a mark has the pointer interaction applied, a mark.point method is assigned to the mark, allowing the pointed value to be controlled programmatically. Assigning a new value re-renders the mark (via the render transform) and re-assigns plot.value, but does not emit an input event or re-render other marks. In cases where it is awkward to specify the pointed value by data, mark.pointIndex(index) can be used to specify the index of the pointed data. mark.point(value) is a convenience method for mark.pointIndex(data.indexOf(value)).
When using the tip option, it could be mark.tip.point(value) for the same effect.
This approach requires retaining a reference to the mark with the pointer interaction applied (or equivalently the mark with the tip applied), but that should be reasonable. I suppose we could also have plot.point that points at all pointer’d marks, too.
- Lingua principale
- HTML
- Stelle
- 5.4k
- Fork
- 246
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di observablehq/plot
-
[Types] Wrong recursion in Mark’s _tip_ optionForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
observablehq/plot#2459 · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
observablehq/plot#2453 ·
-
Inconsistent type definition of _scale_._transform_Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
observablehq/plot#2451 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
observablehq/plot#2447 · 2 commenti ·
-
Channel documentation with a section describing zForse di nuovo libera @LeonxLJX l’ha presa 38 giorni fa e non c’è nessuna pull request aperta. Apertadocumentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
observablehq/plot#1533 · 3 commenti · 1 reazione ·
Tutte le issue di observablehq/plot
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
zerocracy/judges-action#2714 ·
I maintainer di solito rispondono entro 8 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
pymc-labs/pymc-marketing#3140 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
syedhamidali/radarx#198 ·
I maintainer di solito rispondono entro 1 giorno
-
Integration:azure_functions needs:triage Team:Obs-InfraObs
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
elastic/integrations#21931 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
HafidIdrissi/Time-Tracker#356 ·
I maintainer di solito rispondono entro 1 giorno