library(shiny)
library(bslib)
devtools::load_all("../../r-package")
ui <- page_sidebar(
title = "Hello Shiny!",
tags$head(
tags$script("console.log('Hello Shiny!');")
),
sidebar = sidebar(
sliderInput(
inputId = "bins",
label = "Number of bins:",
min = 1,
max = 50,
value = 30
)
),
plotOutput(outputId = "distPlot")
)
server <- function(input, output) {
output$distPlot <- renderPlot({
x <- faithful$waiting
bins <- seq(min(x), max(x), length.out = input$bins + 1)
debug("Rendering plot")
hist(
x,
breaks = bins,
col = "#007bc2",
border = "white",
xlab = "Waiting time to next eruption (in mins)",
main = "Histogram of waiting times"
)
})
}
shinyApp(ui, server)