plotly / plotly/plotly.js

[FEATURE]: Freeze hovertext on click

Ouverte
#7,663 3 commentaires 2 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

feature
Langage dominant
JavaScript
Étoiles
18.3k
Forks
2k
Merge moyen
2 j 12 h
PR mergées (30 j)
28

Description

Description

I would like to freeze the location of my hovertext with a click callback. Once frozen, the hovertext would no longer follow the cursor, but instead be frozen in place. Another click would release the hovertext, so that it follows the cursor again. I feel like this should be possible by temporarily disabling the internal plotly callback that moves the hovertext with the cursor.

Why should this feature be added?

There are two ways for moving the hovertext. You can move it with the cursor or you can move it programmatically with Plotly.Fx.hover. If you are moving the hovertext programmatically, it is helpful to 'turn off' the cursor interaction, otherwise the user may inadvertently move the hovertext when they move the cursor. In my project, the user is trying to find an 'optimal' location in the heatmap. I think it would be useful if they could make an initial placement of hovertext using the cursor, click to freeze it there, and then make subsequent 'tweeks' to the hovertext location using input fields elsewhere in the app.

Mocks/Designs

This prototype is built from the D3.js heatmap example and a global frozen variable as suggested on StackOverflow. Notice how the tooltip follows the cursor until the user clicks, whereupon the tooltip is frozen at the clicked location until the user clicks again and unfreezes the tooltip. I would be happy to neaten & share the code if that would be helpful.

Image

Notes
  • Similar to #7578 but slightly simpler, since I am not seeking to make comparisons between different parts of the same plot.
  • Similar to #998 in the sense that I want to persist the hovertext on click.
  • There is a workaround for temporarily disabling all mouse interactions on StackOverflow.

Guide de contribution

Ouvrir le guide de contribution

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 suivre Plotly.Fx.hover et le callback interne qui déplace le hovertext avec le curseur. Examinez les issues associées #7578 et #998 ainsi que le prototype D3.js lié. La tâche sera considérée comme terminée lorsqu’un clic figera l’emplacement actuel du hovertext, qu’un second clic rétablira le mouvement du curseur et que le hover programmatique restera utilisable.

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

Évaluation

Stack technique
javascript
Domaine
data-visualization
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

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