plotly / plotly/plotly.js

Hover info is sticky on touch interfaces even after the source graph is changed

Ouverte
#6,783 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

bug cs P2 sev-2
Langage dominant
JavaScript
Étoiles
18.3k
Forks
2k
Merge moyen
2 j 12 h
PR mergées (30 j)
28

Description

On touch interface, hover info displays when a data point is clicked. This is perfect. Although, the info seems to be sticky even after changing the source graph . I haven’t found a straightforward way to change this. I’ve tried using various parameters like clear_on_unhover, hoverData, hoverinfo, selectedpoints. Looks like the interaction gets captured as a click on touch so I tried to work with properties like clickData.

Below is a minimal working example and and some screenshots to illustrate. The app has a dropdown menu and an a graph. The graph changes with the dropdown selection. The hover info lingers even if the graph is change using the dropdown. Ideally, the label could disappear when the source graph is changed. This would be great for a touch interface friendly UX as the hover label is a nice way to pack in more info on a small display like mobile.

Thanks for looking into this! @Coding-with-Adam

minitest_screenshot

# Import modules
import plotly.graph_objs as go
import dash
from dash import dcc
from dash import html
from dash.dependencies import Input, Output

# App layout 
app = dash.Dash(__name__)
app.layout = html.Div([
    dcc.Dropdown(
        id='dropdown',
        options=[
            {'label': 'Graph 1', 'value': 1},
            {'label': 'Graph 2', 'value': 2}
        ],
        value=1
    ),
    dcc.Store(id='click-data-store'),
    dcc.Graph(id='graph')
])
  
# Dropdown graph callback
@app.callback(
  Output('graph', 'figure'),
  [Input('dropdown', 'value')]
)
def update_graph(selected_value):
  figure = go.Figure()

  if selected_value == 1:
      figure.add_trace(go.Bar(x=['ABCT','DEFR','GHIP'], y=[4, 5, 6], name='Graph 1'))
  elif selected_value == 2:
      figure.add_trace(go.Bar(x=['JKWW','STVP','CXYZ'], y=[3, 10, 4], name='Graph 2'))
  
  return figure

# Run app
if __name__ == '__main__':
    app.run_server(debug=False, host="0.0.0.0", port=1005)

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 exécuter l’application Dash minimale de l’issue sur une interface tactile, sélectionner un point de données et modifier le graphique source du dropdown. Suivez la manière dont la mise à jour du graphique interagit avec l’état de click ou de hover capturé ; c’est terminé lorsque l’ancien libellé de hover disparaît quand le graphique source change, sans casser le comportement de hover tactile.

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

Évaluation

Stack technique
javascript
Domaine
data-visualization, frontend
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
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.