discreteColorFilter: Add a visual filter input for discrete values

Description Usage Arguments Value Server value See Also Examples

View source: R/input-colorfilters.R

Description

The brush used in this filter snaps to evenly divided steps based on the number of colors passed as argument. With minValue = 0, maxValue = 100 and n = 5, it will snap at the edges (0 and 100) and 20, 40, 60, and 80.

Usage

1

Arguments

inputId

The input slot that will be used to access the value.

...

Arguments passed on to numericLegend

label

Display label for the control, or NULL for no label.

class

The CSS class of the input div element to match with any brush-defining functions. Default classes for brushes are either "continuous-color-filter" or "discrete-color-filter".

n

Number of color strips in the legend. Default is 100.

minValue

Minimum numeric value in the legend (can be higher the maximum for inverted scale).

maxValue

Maximum numeric value in the legend (can be lower the minimum for inverted scale).

data

Alternative vector to extract numeric minimum and maximum values.

colors

Colours to interpolate; must be a valid argument to grDevices::col2rgb(). This can be a character vector of "#RRGGBB" or "#RRGGBBAA", colour names from grDevices::colors(), or a positive integer that indexes into grDevices::palette().

palette

A function that outputs a list of colors

options

Configuration options for brush and scale. Use ticks to specify number of ticks or a list of specific tick values , format to a d3-format-compatible formatting string (see https://github.com/d3/d3-format for valid formats) and hide_brush_labels as TRUE to hide the brush interval.

orient

Orientation of the legend. Can be "bottom" (default, horizontal with labels below), "top" (horizontal with labels above), "left" (vertical with labels on the left) and "right" (vertical with labels on the right).

size

Absolute length in pixels of the color bar; becomes width or height depending on value of orient. Default is 200.

thickness

Absolute thickness in pixels of the color bar; opposite of size depending on value of orient. Default is 20.

offset

Left offset for scale to allow long labels. Default is 0.

Value

A visual filter input control that can be added to a UI definition.

Server value

start and end bounds of a selection. The input value is NULL for empty selections.

start and end bounds of a selection. The default value is null.

See Also

numericLegend()

Other visual filters: categoricalColorFilter(), continuousColorFilter()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Only run examples in interactive R sessions
if (interactive()) {

ui <- fluidPage(
  discreteColorFilter("filter", minValue = 0, maxValue = 200, n = 5,
                        palette = scales::viridis_pal()),
  verbatimTextOutput("value")
)
server <- function(input, output) {
  output$value <- output$selection <- renderPrint({
  if (!is.null(input$filter)) {
    paste0(input$filter$start, ",", input$filter$end)
  }
})
}
shinyApp(ui, server)
}

rhenkin/vfinputs documentation built on Oct. 23, 2020, 1:30 a.m.