categoricalLegend: Create a categorical legend

Description Usage Arguments Value See Also

View source: R/base-legends.R

Description

Create a color legend based on given data and palette or colors. Also passes on data- attributes for optional JS interaction.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
categoricalLegend(
  inputId,
  label = NULL,
  class = "",
  values = NULL,
  data = NULL,
  colors = NULL,
  palette = NULL,
  orient = "bottom",
  size = 220,
  multiple = TRUE
)

Arguments

inputId

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

label

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

class

The CSS class of the input div element to match with any filter toggling functions. Default class is "categorical-color-filter".

values

List of character vectors that will match with the colors or palette in the order provided by both.

data

Alternative vector to extract values with "unique()" function.

colors

Colours to match with values; 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.

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 220.

multiple

Is selection of multiple items allowed? Default is TRUE. With FALSE, selecting one item will de-select the others.

Value

A categorical color legend control that can be added to a UI definition

See Also

discreteColorFilter() continuousColorFilter() categoricalColorFilter()

Other base legend: numericLegend()


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