Hi all,
I was wondering if it is possible to use the value from a sliderInput() as label for a chart. I tried to build it using reactive() but instead of displaying the value as label is displays a bunch of text (see reproducible example as included below).
Any hints how to solve are much appreciated.
library(shiny)
PT <- c(0.5, 0.5)
label1 <- c(data, 5)
label2 <- c(0, 0)
ui <- fluidPage(
fluidRow(column(width=6, plotOutput("P1", width = "30vw")), column(width = 6, plotOutput("P2", width = "30vw"))),
sliderInput("S1", label = NULL, min = 0, max = 10, value = 5)
)
server <- function(input, output) {
data <- reactive({ c(input$S1) })
output$P1 <- renderPlot({
pie(PT, labels = label1, init.angle = 90)
})
output$P2 <- renderPlot({
pie(PT, labels = label2, init.angle = 90)
})
}
shinyApp(ui = ui, server = server)