inst/examples/update/app.R

library(shiny)
library(htmltools)
library(histoslider)

ui <- bslib::page_fluid(
  div(
    style = css(
      width = "50%",
      marginLeft = "auto",
      marginRight = "auto",
      display = "flex",
      flexDirection = "column",
      alignItems = "center"
    ),
    input_histoslider("slide", NULL, mtcars$mpg),
    selectInput("var", NULL, names(mtcars), selected = "mpg", width = "fit-content", selectize = FALSE)
  )
)

shinyApp(
  ui,
  function(input, output) {
    observe({
      vals <- mtcars[[input$var]]
      update_histoslider("slide", values = vals)
    })
  }
)

Try the histoslider package in your browser

Any scripts or data that you put into this service are public.

histoslider documentation built on Nov. 4, 2023, 1:06 a.m.