Hi and thanks for reading this. I am trying to make a bar plot with value labels on echarts4r
, but I can't change the orientation of the labels so that the values do not overlap. I tried orient = "vertical"
but it doesn't work. My code is as follows:
library(echarts4r)
library(dplyr)
mtcars |>
tibble::rownames_to_column("model") |>
mutate(cyl2 = cyl*10000) |>
e_charts(model) |>
e_bar(cyl2,
label = list(
show = TRUE,
position = "top",
orient = "vertical",
textStyle = list(fontFamily = "Roboto Condensed",
fontSize = 12)
))
Is there a way to change the orientation of the labels? Thanks for the help
You could set the orientation of the value labels via the rotation
parameter. Depending on your desired result you also have to set the verticalAlignment
and the horizontal align
ment:
library(echarts4r)
library(dplyr)
mtcars |>
tibble::rownames_to_column("model") |>
mutate(cyl2 = cyl*10000) |>
e_charts(model) |>
e_bar(cyl2,
label = list(
show = TRUE,
position = "top",
rotate = 90,
verticalAlign = "middle",
align = "left",
textStyle = list(fontFamily = "Roboto Condensed",
fontSize = 12)
))