updateVisibility | R Documentation |
Hide or show an existing NGLVieweR selection in Shinymode.
updateVisibility(NGLVieweR_proxy, name, value = FALSE)
NGLVieweR_proxy |
A NGLVieweR object. |
name |
Name of selection to alter the color. |
value |
Hide |
API call containing NGLVieweR
id
and list of message
parameters.
NGLVieweR_example()
See example "updateVisibility".
Other updates:
updateColor()
,
updateRepresentation()
,
updateStage()
## Not run:
NGLVieweR_proxy("structure") %>%
updateVisibility("cartoon", value = TRUE)
## End(Not run)
if (interactive()) {
library(shiny)
ui = fluidPage(
titlePanel("Viewer with API inputs"),
sidebarLayout(
sidebarPanel(
actionButton("show", "Show"),
actionButton("hide", "Hide"),
),
mainPanel(
NGLVieweROutput("structure")
)
)
)
server = function(input, output) {
output$structure <- renderNGLVieweR({
NGLVieweR("7CID") %>%
addRepresentation("cartoon",
param = list(name = "cartoon", color="residueindex"))
})
observeEvent(input$show, {
NGLVieweR_proxy("structure") %>%
updateVisibility("cartoon", value = TRUE)
})
observeEvent(input$hide, {
NGLVieweR_proxy("structure") %>%
updateVisibility("cartoon", value = FALSE)
})
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.