Closed wagathu closed 11 months ago
Howdy! Thanks for the feature request.
I don't currently have plans to enable this feature because "change" is relatively arbitrary, because are we just looking at the first vs last? The overall trend? Or some other constraint.
I think a better option is user defined value that indicate increases or decreases, such as:
library(gt)
library(gtExtras)
library(dplyr)
dd <- data.frame(
where = c("where1", "where2", "where3", "where4"),
"year_2014" = c(30, 60, 20, 10),
"year_2022" = c(10, 50, 30, 20))
dd |> rowwise() |>
mutate(change = list(c(year_2014, year_2022))) |>
mutate(dir = last(change)- first(change)) |>
gt() |>
gt_plt_sparkline(change, label = FALSE) |>
gtExtras::gt_fa_rank_change(
column = dir, font_color = "match"
)
Closing as not planned
I raised the same question on SO
I am working on a gtExtras table with the following example
I intend to color the Sparkline (the full Sparkline and not the end, as it in the default) depending on whether there was a decrease "green" or an increase "red".
How do I proceed?