I have a stacked bar chart and I want to add a value label above each stacked bar. I don't want values for each section of the stack.
This yields a value for each section of the stack:
library(echarts4r)
set.seed(1)
d <- data.frame(
xaxis = c(rep("a", 2), rep("b", 2)),
groups = c("c", "d", "c", "d"),
value = rnorm(4, mean = 50)
)
d |>
group_by(groups) |>
e_chart(xaxis) |>
e_bar(value, stack = "grp1") |>
e_labels()
I just want one number above each bar, equal to the sum of each section.