plotly / plotly/react-plotly.js
[Question] How to tell which point is clicked on when using onClick Event with multiple traces?
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 1.1k
- Fork
- 138
- Merge medio
- 3g 2h
- PR unite (30g)
- 4
Descrizione
I have setup a react application where I am using createPlotComponent to create an instance of an graph that I can interact with and I am controlling it using react-chart-editor
constructor() {
this.PlotComponent = createPlotComponent(plotly)
}
<this.PlotComponent
...data ,frames etc
onClick={(e) => {
console.log(e)
}}/>
The problem I am having is that when I have multiple traces on my graph, I want to determine which trace I am clicking. At the moment the event from onClick exposes the points (an array of all of the points clicked) and a MouseEvent which shows information about the point on the graph that is clicked. Is there any way to get specifically the information about the one point that is clicked on?
There might be a way to determine which point is clicked by using the mouse event and matching up the position of the mouse click on the graph with the position of the point on the graph. However, there doesn't seem to access the position of the points on the graph in terms of their coordinates
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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.
Direzione di ricerca
Inizia con l’uso di createPlotComponent e del callback onClick mostrati nell’issue, quindi esamina l’array event.points e il MouseEvent prodotto per più trace. Determina se i dati dell’evento esistenti identificano la trace e il punto selezionati; il lavoro è completato quando viene documentato o esposto un modo affidabile per distinguere il punto cliccato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, react
- Ambito
- data-visualization, frontend
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100