| discreteColorFilter {vfinputs} | R Documentation |
Add a visual filter input for discrete values
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
discreteColorFilter(inputId, ...)
Arguments
inputId |
The input slot that will be used to access the value.
|
... |
Arguments passed on to numericLegend
labelDisplay label for the control, or NULL for no label.
classThe 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".
nNumber of color strips in the legend. Default is 100.
minValueMinimum numeric value in the legend (can be higher the maximum for inverted scale).
maxValueMaximum numeric value in the legend (can be lower the minimum for inverted scale).
dataAlternative vector to extract numeric minimum and maximum values.
colorsColours 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().
paletteA function that outputs a list of colors
optionsConfiguration 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.
orientOrientation 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).
sizeAbsolute length in pixels of the color bar; becomes width or height depending on value of orient. Default is 200.
thicknessAbsolute thickness in pixels of the color bar; opposite of size depending on value of orient. Default is 20.
offsetLeft 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
## 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)
}
[Package
vfinputs version 0.1.0
Index]