`on_selection` callback seems to not get fired
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
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!
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先在 Jupyter 中以及作为 Python 脚本运行提供的 FigureWidget 示例,重点关注图形的 on_selection 回调和 dragmode="select" 设置。跟踪选择事件路径,并将行为与链接的 selection-events 文档和 issue #2698 进行比较;完成的标准是解释清楚回调行为,并修复报告中的示例,或明确确定其受支持的用法。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- jupyter-notebook, python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100