Skip to content

Commit a05a5e2

Browse files
committed
Add another background bar chart style
1 parent 0e26958 commit a05a5e2

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

vignettes/cookbook/cookbook.Rmd

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -266,20 +266,29 @@ bar_style <- function(width = 1, fill = "#e6e6e6", height = "75%", align = c("le
266266
267267
data <- mtcars[, 1:4]
268268
269-
reactable(data, columns = list(
270-
mpg = colDef(
271-
style = function(value) {
272-
bar_style(width = value / max(data$mpg), fill = "#2c5e77", color = "#fff")
273-
},
274-
align = "left",
275-
format = colFormat(digits = 1)
269+
reactable(
270+
data,
271+
columns = list(
272+
mpg = colDef(
273+
style = function(value) {
274+
bar_style(width = value / max(data$mpg), fill = "#2c5e77", color = "#fff")
275+
},
276+
align = "left",
277+
format = colFormat(digits = 1)
278+
),
279+
disp = colDef(
280+
style = function(value) {
281+
bar_style(width = value / max(data$disp), fill = "hsl(208, 70%, 90%)")
282+
}
283+
),
284+
hp = colDef(
285+
style = function(value) {
286+
bar_style(width = value / max(data$hp), height = "90%", align = "right")
287+
}
288+
)
276289
),
277-
disp = colDef(
278-
style = function(value) {
279-
bar_style(width = value / max(data$disp), height = "90%", align = "right")
280-
}
281-
)
282-
))
290+
bordered = TRUE
291+
)
283292
```
284293

285294
## Embed images

0 commit comments

Comments
 (0)