Skip to contents

Set traffic light formatter

Usage

set_formatter_traffic_light(
  widget,
  columns,
  min = NA,
  max = NA,
  color = c("green", "orange", "red"),
  hoz_align = "center"
)

Arguments

widget

A tabulator() HTML widget.

columns

The names of the columns the formatter is applied to.

min

(numeric): The minimum value for progress bar. If set to NA, the minimum value of the column is used.

max

(numeric): The maximum value for progress bar. If set to NA, the maximum value of the column is used.

color

(character): Either a single color or a vector of colors

hoz_align

(character): The horizontal alignment of the column.

Value

The updated tabulator() HTML widget

Examples

data <- data.frame(
  label = 1:10,
  value = 1:10
)

tabulator(data, width = 200) |>
  set_formatter_traffic_light("value") |>
  set_formatter_plaintext("label", hoz_align = "center")