Title: A Histogram Slider Input for 'Shiny'
Version: 0.1.1
Description: A histogram slider input binding for use in 'Shiny'. Currently supports creating histograms from numeric, date, and 'date-time' vectors.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.2.3
Imports: rlang, htmltools, reactR, shiny
Suggests: testthat, shinytest2, bslib
NeedsCompilation: no
Packaged: 2023-11-03 23:21:26 UTC; cpsievert
Author: Carson Sievert ORCID iD [cre, aut], Samuel Hogg [ctb, cph] (Original author of histoslider React component)
Maintainer: Carson Sievert <cpsievert1@gmail.com>
Repository: CRAN
Date/Publication: 2023-11-04 00:30:02 UTC

Create a histogram slider

Description

Creates a Shiny UI input binding to a histogram with a slider "filter" control.

Usage

input_histoslider(
  id,
  label,
  values,
  start = NULL,
  end = NULL,
  width = "100%",
  height = 175,
  breaks = rlang::missing_arg(),
  options = list()
)

Arguments

id

An input id.

label

A label for the input (can be NULL or a string).

values

a vector of numeric values for which the histogram is desired.

start

A numeric value for the starting handle.

end

A numeric value for the ending handle.

width, height

Any valid CSS unit defining the width/height.

breaks

determines how histogram bins are computed (see hist() for possible values and details).

options

a list of histoslider options.

Value

A Shiny UI input element.

See Also

update_histoslider

Examples


if (interactive()) {
  library(shiny)
  shinyApp(
    input_histoslider("x", "Random", rnorm(100)),
    function(input, output) {
      observe(print(input$x))
    }
  )
}


Update a histogram slider

Description

Change the value of a input_histoslider() on the client (must be called inside a currently active user session). See here for an example.

Usage

update_histoslider(
  id,
  label = NULL,
  values = NULL,
  start = NULL,
  end = NULL,
  breaks = rlang::missing_arg(),
  options = NULL,
  session = shiny::getDefaultReactiveDomain()
)

Arguments

id

An input id.

label

A label for the input (can be NULL or a string).

values

a vector of numeric values for which the histogram is desired.

start

A numeric value for the starting handle.

end

A numeric value for the ending handle.

breaks

determines how histogram bins are computed (see hist() for possible values and details).

options

a list of histoslider options.

session

The shiny user session object.

Details

Any arguments with NULL values will be ignored; they will not result in any changes to the input object on the client.

Value

Nothing.

See Also

input_histoslider