【发布时间】:2021-09-14 00:00:00
【问题描述】:
我正在使用 dataui 包来创建迷你图。我希望对角线填充的颜色与迷你图的颜色相匹配。
因此,A 公司将有一条绿线,下方有绿色对角线填充,而 B 公司将有一条红线,下方有红色对角线填充。
我似乎无法让对角线填充具有多个值。
这可能吗?
library("tidyverse")
library("dataui")
library("reactable")
df <- tibble(
Company = c("A", "B"),
Line = list(list(c(1, 2, 1)), list(c(2, 2, 1)))
)
colpal <- c("#00DA07", "#BB0337")
rt1 <- reactable(df,
compact = TRUE,
fullWidth = FALSE,
columns = list(
Line = colDef(
cell = function(value, index) {
dui_sparkline(
data = value[[1]],
height = 80,
components = list(
dui_sparklineseries(
curve = "linear",
showArea = TRUE,
fill = "url(#area_pattern2)",
stroke = colpal[index]),
# Diagonal fill lines
dui_sparkpatternlines(
id = "area_pattern2",
height = 4,
width = 4,
stroke = colpal[index],
strokeWidth = 1,
orientation = "diagonal"
)
)
)
}
)
)
)
rt1
【问题讨论】:
标签: r sparklines