plotly / plotly/react-plotly.js

How do I use Plotly.Fx.hover with react-plotly.js?

Ouverte
#339 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
JavaScript
Étoiles
1.1k
Forks
138
Merge moyen
3 j 2 h
PR mergées (30 j)
4

Description

I am building something like this: https://plotly.com/javascript/hover-events/#coupled-hover-events, but I can't find a way to reproduce this behavior with react-plotly.js

Fx is not present in plotly.js anymore (isn't it?), and I can't find a way to find a Plotly's Plot instance (not the wrapper's instance) in order to try different methods.

Does anyone know how I could achieve a similar effect?

What I have so far looks something like:

import {FC, useEffect, useMemo, useRef} from "react";
import {BoxPlotData, Layout} from 'plotly.js'
import Plot from 'react-plotly.js';

export const MyPlot: FC = () => {
  const boxplotRef = useRef<Plot>(null)

  useEffect(() => {
    if (boxplotRef.current) {
      // What now?
      // I would like to do something like
      // boxplotRef.current.plot.hover([ { pointNumber: 1 }, { pointNumber: 2 }, { pointNumber: 3 } ])
    }
  }, []);

  const myLayout = useMemo((): Layout => { ... }, [])
  const myData = useMemo((): Partial<BoxPlotData> => { ... }, [])

  return (
    <Plot
      ref={boxplotRef}
      data={myData}
      layout={myLayout}
    />
  )
}

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par l’exemple Plotly coupled-hover-events lié et le ref react-plotly.js affiché dans l’issue. Comparez le ref du wrapper avec le comportement Plotly.Fx.hover demandé ; le travail est terminé lorsqu’une manière prise en charge de reproduire l’interaction de hover couplée avec le composant affiché a été identifiée.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript, plotly, react, typescript
Domaine
data-visualization, frontend
Type d'issue
Fonctionnalité
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.