View source: R/billboarder-shiny.R
bb_proxy_focus | R Documentation |
Highlights specified targets and fade out the others.
bb_proxy_focus(proxy, ids = NULL)
bb_proxy_defocus(proxy, ids = NULL)
proxy |
A |
ids |
Data ids (names) to be highlighted, if |
A billboardProxy
htmlwidget
object.
bb_defocus
is the opposite of bb_focus
if (interactive()) {
library("shiny")
library("billboarder")
ui <- fluidPage(
tags$h1("Proxy method to highlight data"),
checkboxGroupInput(
inputId = "focus",
label = "Focus",
choices = c("setosa", "versicolor", "virginica"),
inline = TRUE
),
billboarderOutput(outputId = "bb")
)
server <- function(input, output, session) {
output$bb <- renderBillboarder({
billboarder() %>%
bb_scatterplot(
data = iris,
x = "Sepal.Length",
y = "Sepal.Width",
group = "Species"
) %>%
bb_axis(x = list(tick = list(fit = FALSE))) %>%
bb_point(r = 8)
})
observeEvent(input$focus, {
billboarderProxy("bb") %>%
bb_proxy_focus(input$focus)
}, ignoreNULL = FALSE)
}
shinyApp(ui = ui, server = server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.