FR: Add support for plotly_sunburstclick and plotly_treemapclick in highlight()
未关闭
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
As sunburst/treemap charts have their own click-events: plotly_sunburstclick / plotly_treemapclick it would be nice to support them in highlight.
The following (plotly_click) doesn't work as expected:
library(plotly)
library(crosstalk)
sunburstDF <- structure(list(labels = structure(c(1L, 3L, 4L, 2L, 7L, 6L, 5L,
7L, 6L, 5L, 7L, 6L, 5L), levels = c("Total", "mixed", "private",
"public", "commercial", "recreation", "residential"), class = "factor"),
values = c(1658, 353, 1120, 185, 108, 143, 102, 300, 320,
500, 37, 58, 90), parents = c(NA, "Total", "Total", "Total",
"Total - private", "Total - private", "Total - private",
"Total - public", "Total - public", "Total - public", "Total - mixed",
"Total - mixed", "Total - mixed"), ids = c("Total", "Total - private",
"Total - public", "Total - mixed", "Total - private - residential",
"Total - private - recreation", "Total - private - commercial",
"Total - public - residential", "Total - public - recreation",
"Total - public - commercial", "Total - mixed - residential",
"Total - mixed - recreation", "Total - mixed - commercial"
)), row.names = c(NA, -13L), class = "data.frame")
d <- highlight_key(sunburstDF, ~ids)
fig <- plot_ly(data = d, ids = ~ids, labels= ~labels, parents = ~parents, values= ~values, type='sunburst', branchvalues = 'total')
fig1 <- fig2 <- highlight(fig, on = "plotly_click", off = "plotly_doubleclick", dynamic = FALSE)
crosstalk::bscols(fig1, fig2)
Related: allow plotly_unhover as an off event: https://github.com/plotly/plotly.R/issues/1864
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先追踪 highlight() 如何处理事件名称 plotly_click 和 plotly_doubleclick,然后将该行为与提供的 sunburst 和 treemap 示例进行比较。验证 crosstalk 视图是否响应 plotly_sunburstclick 和 plotly_treemapclick,同时保留现有的 highlight 行为;该 issue 还将 plotly_unhover 标识为相关的 off-event 请求。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100