# NOT RUN {
data <- iris[10:29, ]
## By default, the bubble_grid() function uses a blue-white-orange three-color pattern:
reactable(
data,
columns = list(
Petal.Length = colDef(
align = "center",
cell = bubble_grid(data))))
## You can specify your own color palette or a single color across all values with `colors`;
reactable(
data,
columns = list(
Petal.Length = colDef(
align = "center",
cell = bubble_grid(data,
colors = c("orange")))))
## Use squares instead of circles:
reactable(
data,
columns = list(
Petal.Length = colDef(
align = "center",
cell = bubble_grid(data,
shape = "squares"))))
## Hide text and show on hover by enabling the tooltip:
reactable(
data,
columns = list(
Petal.Length = colDef(
align = "center",
cell = bubble_grid(data,
show_text = FALSE,
tooltip = TRUE))))
## Control the scale of the circles by adjusting the min and max values:
reactable(
data,
columns = list(
Petal.Length = colDef(
align = "center",
cell = bubble_grid(data,
min_value = 1,
max_value = 2))))
## Use span to apply bubbles to values in relation to the entire data set:
reactable(
data,
defaultColDef = colDef(
cell = bubble_grid(data,
span = TRUE)))
## Use number_fmt to format numbers using the scales package:
car_prices <- MASS::Cars93[20:49, c("Make", "Price")]
reactable(car_prices,
defaultColDef = colDef(
align = "center",
cell = bubble_grid(car_prices,
number_fmt = scales::dollar)))
# }
Run the code above in your browser using DataLab