numericLegend {vfinputs}R Documentation

Create a numeric legend

Description

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

Usage

numericLegend(
  inputId,
  label = NULL,
  class = "",
  n = 100,
  minValue = NULL,
  maxValue = NULL,
  data = NULL,
  colors = NULL,
  palette = NULL,
  options = NULL,
  orient = "bottom",
  size = 200,
  thickness = 20,
  offset = 0
)

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 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 numeric color legend control that can be added to a UI definition

See Also

discreteColorFilter() continuousColorFilter() categoricalColorFilter()

Other base legend: categoricalLegend()


[Package vfinputs version 0.1.0 Index]