highlight() function: setting the 'off' event to 'plotly_unhover' results in an error.
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
This is a modified example from here:
library(plotly)
# load the `txhousing` dataset
data(txhousing, package = "ggplot2")
# declare `city` as the SQL 'query by' column
tx <- highlight_key(txhousing, ~city)
# initiate a plotly object
base <- plot_ly(tx, color = I("black")) %>%
group_by(city)
# create a time series of median house price
time_series <- base %>%
group_by(city) %>%
add_lines(x = ~date, y = ~median)
highlight(
time_series,
on = "plotly_hover",
off = "plotly_hover", # causes error
selectize = FALSE,
dynamic = FALSE,
color = "red",
persistent = FALSE
)
Not providing off results in a warning:
Setting the
offevent (i.e., 'plotly_doubleclick') to match theonevent (i.e., 'plotly_hover'). You can change this default via thehighlight()function.
Setting off to plotly_hover or plotly_unhover (my initial intention) results in an error:
Error in match.arg(off, off_options) :
'arg' should be one of “plotly_doubleclick”, “plotly_deselect”, “plotly_relayout”
Found this via: https://stackoverflow.com/a/64387370/9841389
PS: using the latest CRAN version of plotly.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 highlight() 入口点开始,复现将 off 设置为 plotly_hover 和 plotly_unhover 的修改版 txhousing 示例。检查 off_options 验证,并将其与文档所述的事件行为进行比较;完成的标准是,有效的 off 事件不再引发所报告的 match.arg 错误,并且示例按预期运行。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100