r crosstalk filter_select:无法解开已经选择的值
我正在尝试使用 crosstalk
来过滤 plotly
图表。我使用 crosstalk
的 filter_select
来(取消)过滤 plotly
图表。当使用下面的 reprex 尝试选择一朵花(例如 setosa)时,一切正常。但是,当我取消选择花朵时,这些值不会“返回”到 plotly
图表。选择“(全部)”似乎也不起作用。仅当从花过滤器中取消选择并在 helper_select_all 中勾选 TRUE 时,这些值才会重新出现。
library(crosstalk)
library(plotly)
df <- iris
df$helper_select_all <- T
shared_data <- SharedData$new(df)
filter <- bscols(
list(
filter_select("flower", "Select a flower", shared_data, ~Species),
filter_checkbox(
"helper_select_all",
label = "Reset filtering as deselecting from 'Select a flower' is not working",
shared_data, ~helper_select_all)
)
)
p <- plot_ly(shared_data, x = ~Sepal.Length, y = ~Sepal.Width) %>%
add_markers()
bscols(filter, p)
I am trying to use crosstalk
to filter a plotly
chart. I use crosstalk
's filter_select
to (un)filter a plotly
chart. When using the reprex below trying to select a flower (e.g. setosa), all works fine. But when I unselect the flower, the values are not 'returned' to the plotly
chart. Selecting '(All)' does not seem to be working either. The values reappear only when deselecting from flower filter AND ticking TRUE in the helper_select_all.
library(crosstalk)
library(plotly)
df <- iris
df$helper_select_all <- T
shared_data <- SharedData$new(df)
filter <- bscols(
list(
filter_select("flower", "Select a flower", shared_data, ~Species),
filter_checkbox(
"helper_select_all",
label = "Reset filtering as deselecting from 'Select a flower' is not working",
shared_data, ~helper_select_all)
)
)
p <- plot_ly(shared_data, x = ~Sepal.Length, y = ~Sepal.Width) %>%
add_markers()
bscols(filter, p)
This picture demonstrates the issue as no filtering value is selected, but a part of the data is missing.
This picture shows what it looks like when all datapoints are present.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论