plotly / plotly/plotly.R

selectize.js default behavior: remove label and allow for placeholder

未关闭
#2,240 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述

I would like to create an R Markdown document with > 1 plotly figure where points can be highlighted with the selectize.js widget. Here a reproducible example

---
title: Test
output: html_document
---

# wt vs mpg

```{r, message=FALSE, warning=FALSE}
library(plotly)
myData <- highlight_key(mtcars, ~rownames(mtcars))
myFig <- plot_ly(myData, x = ~wt, y = ~mpg) 
highlight(myFig, selectize = TRUE)
```

# disp vs mpg

```{r, message=FALSE}
myData <- highlight_key(mtcars, ~rownames(mtcars))
myFig <- plot_ly(myData, x = ~disp, y = ~mpg) 
highlight(myFig, selectize = TRUE)
```

selectize_label

Two Design improvements would be nice

  1. No label above selectize widget
  2. Placeholder text in the <input> field of the widget

For the first problem I found a workaround using highlight_key(..., group = " "). However I need to define for each plot a new "invisible" group identifier otherwise the highlighting of the plots will be linked (i.e. if I highlight a car in one plot it will be highlighted in all plots). At the moment I use group = " ", group = " ", group = " ", and so on but this is stupid.

A workaround for the placeholder text was already described on Stack Overflow. But it does not work out of the box if there are multiple plotly figures in one R Markdown document.

Optimal solution would be to have two additional arguments in the highlight() function

  • label = NULL makes sure that no label is plotted
  • placeholder = "" to define the placeholder in the selectize box.

Let me know what you think of it : )

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 R 的 highlight() 入口点以及提供的 R Markdown 重现所触发的 selectize.js 行为开始。验证多个 plotly 图形如何共享选择状态,然后使标签抑制和占位符文本可配置,同时保持各图形之间的选择彼此独立。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, r
领域
data-visualization, frontend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。