Description Usage Arguments Value Server value See Also Examples
View source: R/input-colorfilters.R
Add a visual filter input for categorical data
1 | categoricalColorFilter(inputId, ...)
|
inputId |
The |
... |
Arguments passed on to
|
A visual filter input control that can be added to a UI definition
start
and end
bounds of a selection. The default value (or empty selection) is NULL
.
Other visual filters:
continuousColorFilter()
,
discreteColorFilter()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ## Only run examples in interactive R sessions
if (interactive()) {
ui <- fluidPage(
categoricalColorFilter("filter", data = sort(mtcars$gear), orient = "right",
palette = RColorBrewer::brewer.pal(8, "Dark2")),
verbatimTextOutput("value")
)
server <- function(input, output) {
output$value <- output$selection <- renderPrint({
if (!is.null(input$filter)) {
format(input$filter)
}
})
}
shinyApp(ui, server)
ui <- fluidPage(
categoricalColorFilter("filter", label = p("Categorical filter:"),
palette = RColorBrewer::brewer.pal(3, "Accent"),
values = list("a","b","c")),
verbatimTextOutput("values")
)
server <- function(input, output) {
output$value <- output$selection <- renderPrint({
if (!is.null(input$filter)) {
format(input$filter)
}
})
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.