Closed heerymichael closed 2 years ago
Hi Michael,
I just added min_value
and max_value
to color_tiles() and color_scales() to dev that will allow this. Here is the example you described:
Default:
library(reactablefmtr)
data <- data.frame(
Group = c("Group 1","Group 2","Group 3","Group 4","Group 5","Group 6","Group 7"),
Values = c(20, 30, 40, 50, 60, 70, 80)
)
reactable(data,
pagination = FALSE,
columns = list(
Values = colDef(
cell = color_tiles(data,
colors = c("#ffffff","#333333")))
))
Including min_value
and max_value
:
reactable(data,
pagination = FALSE,
columns = list(
Values = colDef(
cell = color_tiles(data,
colors = c("#ffffff","#333333"),
min_value = 0,
max_value = 100))
))
Kyle
This is absolutely brilliant - thank you very much for doing this
Do you have a buy me a coffee/donation type scheme?
Would love you give you some sort of token of appreciation
Michael
Sent from my iPhone
On 20 Jun 2022, at 18:59, Kyle Cuilla @.***> wrote:
Hi Michael,
I just added min_value and max_value to color_tiles() and color_scales() to dev that will allow this. Here is the example you described:
Default:
library(reactablefmtr)
data <- data.frame( Group = c("Group 1","Group 2","Group 3","Group 4","Group 5","Group 6","Group 7"), Values = c(20, 30, 40, 50, 60, 70, 80) )
reactable(data, pagination = FALSE, columns = list( Values = colDef( cell = color_tiles(data, colors = c("#ffffff","#333333"))) ))
Including min_value and max_value:
reactable(data, pagination = FALSE, columns = list( Values = colDef( cell = color_tiles(data, colors = c("#ffffff","#333333"), min_value = 0, max_value = 100)) ))
— Reply to this email directly, view it on GitHubhttps://github.com/kcuilla/reactablefmtr/issues/33#issuecomment-1160713074, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH4QKM4QF537UNJXNPMFEY3VQCWOPANCNFSM5WHM7HGA. You are receiving this because you authored the thread.Message ID: @.***>
No problem! I think it's a really great addition to the package and probably something I should've added sooner!
And thank you so much, I really appreciate that! Here's the link to my coffee page: https://www.buymeacoffee.com/kcuilla
Hi - I was hoping it would be possible to get some help with applying the cooler fills to cells based on cell value.
I have been working at this but so far haven't been able to find out how to control the end ranges of the fill colours. For example if I wanted my colours to go from white to black (#ffffff to #333333) on a 0 to 100 scale but where the data only ranges from 20 to 80. So I don't want the lowest value within my data to be white - rather want it to be coloured within a scale of 0-100?
Is it possible to control the ranges in this way?
Thanks
Michael