library(shiny)
library(shinyXYpad)
ui <- fluidPage(
fluidRow(
column(6, XYpadInput("xy", onMove = TRUE, label = "XY pad")),
column(6, verbatimTextOutput("xyvalue"))
),
br(),
actionButton("update", "Update")
)
server <- function(input, output, session){
output[["xyvalue"]] <- renderPrint({ input[["xy"]] })
observeEvent(input[["update"]], {
updateXYpadInput(session, "xy", value = list(x = 25, y = 25),
bgColor = "chartreuse", pointColor = "yellow",
pointRadius = 10, ndecimals = 3)
})
}
if(interactive()){
shinyApp(ui, server)
}
Run the code above in your browser using DataLab