updateKnobInput | R Documentation |
Change the value of a knob input on the client
updateKnobInput(
session = getDefaultReactiveDomain(),
inputId,
label = NULL,
value = NULL,
options = NULL
)
session |
Standard shiny |
inputId |
The id of the input object. |
label |
The label to set for the input object. |
value |
The value to set for the input object. |
options |
List of additional parameters to update, use |
if (interactive()) {
library("shiny")
library("shinyWidgets")
ui <- fluidPage(
tags$h1("knob update examples"),
br(),
fluidRow(
column(
width = 6,
knobInput(
inputId = "knob1", label = "Update value:",
value = 75, angleOffset = 90, lineCap = "round"
),
verbatimTextOutput(outputId = "res1"),
sliderInput(
inputId = "upknob1", label = "Update knob:",
min = 0, max = 100, value = 75
)
),
column(
width = 6,
knobInput(
inputId = "knob2", label = "Update label:",
value = 50, angleOffset = -125, angleArc = 250
),
verbatimTextOutput(outputId = "res2"),
textInput(inputId = "upknob2", label = "Update label:")
)
)
)
server <- function(input, output, session) {
output$res1 <- renderPrint(input$knob1)
observeEvent(input$upknob1, {
updateKnobInput(
session = session,
inputId = "knob1",
value = input$upknob1
)
}, ignoreInit = TRUE)
output$res2 <- renderPrint(input$knob2)
observeEvent(input$upknob2, {
updateKnobInput(
session = session,
inputId = "knob2",
label = input$upknob2
)
}, ignoreInit = TRUE)
}
shinyApp(ui = ui, server = server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.