`on_selection` callback seems to not get fired
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 18.8k
- Forks
- 2.8k
- Merge medio
- 16 h 26 min
- PR fusionados (30 d)
- 21
Descripción
Thanks for your interest in Plotly.py!
Before opening an issue, please search for existing and closed issues :)
Please accompany bug reports with a reproducible example. Please use the latest version of plotly.py in your report unless not applicable.
Note that GitHub Issues are meant to be used for bug reports and feature requests only. Implementation or usage questions should be asked on community.plotly.com or on Stack Overflow (tagged plotly).
It seems the on_selection callback does not fire anymore. I've seen a number of open and closed issues back from 2020 discussing the usage of it, but based on the newest version 5.10.0 I cannot get anything to fire on a selection.
The simplest code example I could find (from https://github.com/plotly/plotly.py/issues/2698)
import plotly.graph_objects as go
import numpy as np
np.random.seed(1)
x = np.random.randn(500)
def on_selection_print(obj, points, selector):
print(points.point_inds)
figure_widget = go.FigureWidget(data=[go.Histogram(x=x)])
figure_widget.update_layout(dragmode="select")
figure_widget.data[0].on_selection(on_selection_print)
figure_widget.show()
Both running this in jupyter or as a python script, nothing seems to print.
I tried the latest docs on selection events but I couldn't actually get that example to run in jupyter or otherwise.
Am I just missing something simple?
Thanks!
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza ejecutando el ejemplo proporcionado de FigureWidget en Jupyter y como script de Python, centrándote en el callback on_selection de la figura y en la configuración dragmode="select". Sigue la ruta del evento de selección y compara el comportamiento con la documentación enlazada sobre eventos de selección y el issue #2698; se considera terminado cuando el comportamiento del callback esté explicado y el ejemplo reportado esté corregido o se haya establecido claramente su uso compatible.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- jupyter-notebook, python
- Área
- data-visualization
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Tranquilo
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 35/100