I would like to have a styleColorBar in my datatable where the size of the bar is based on a different column.
iris %>%
select(Species, Petal.Length) %>%
group_by(Species) %>%
mutate(avg_petal = mean(Petal.Length)) %>%
datatable() %>%
formatStyle(
'Petal.Length',
background = styleColorBar(iris$Petal.Length, 'steelblue'),
backgroundSize = '100% 90%',
backgroundRepeat = 'no-repeat',
backgroundPosition = 'center'
)
How can I add a color bar to the Species column based on the avg_petal column?
Is this possible?
