updateStage {NGLVieweR} | R Documentation |
Update Stage
Description
Update an existing NGLVieweR stage in Shinymode.
Usage
updateStage(NGLVieweR_proxy, param = list())
Arguments
NGLVieweR_proxy |
A NGLVieweR object. |
param |
Of type list. Most common options are |
Value
API call containing NGLVieweR
id
and list of message parameters.
See Also
-
NGLVieweR_example()
See example "updateStage".
Other updates:
updateColor()
,
updateRepresentation()
,
updateVisibility()
Examples
## Not run:
NGLVieweR("7CID") %>%
addRepresentation("cartoon",
param = list(name = "cartoon", color="red")) %>%
stageParameters(backgroundColor = "black")
## End(Not run)
if (interactive()) {
library(shiny)
ui = fluidPage(
titlePanel("Viewer with API inputs"),
sidebarLayout(
sidebarPanel(
selectInput("background", "Background", c("black", "white", "blue")),
actionButton("update", "Update"),
),
mainPanel(
NGLVieweROutput("structure")
)
)
)
server <- function(input, output) {
output$structure <- renderNGLVieweR({
NGLVieweR("7CID") %>%
addRepresentation("cartoon",
param = list(name = "cartoon", color = "red")
) %>%
stageParameters(backgroundColor = "black")
})
observeEvent(input$update, {
NGLVieweR_proxy("structure") %>%
updateStage(
param = list("backgroundColor" = isolate(input$background)))
})
}
shinyApp(ui, server)
}
[Package NGLVieweR version 1.3.1 Index]