There are a number of new features brought by version 5 of echarts.js, not all are showcased here, see the official changelog for more information.

Dark mode

Darkmode helps when using dark backgrounds, it’ll automatically re-color labels, grid lines, legend text, etc.

library(echarts4r)

e_charts(mtcars, qsec, darkMode = TRUE) %>% 
  e_scatter(mpg, wt) %>% 
  e_labels() %>% 
  e_color(background = "black")

Aria Decal

Decal provides a new visual type that does not only augment aria scenarios but also enrich visual effects.

df <- data.frame(
  x = rep(letters, 2),
  y = round(runif(52, 20, 50)),
  grp = rep(c("A", "B"), each = 26)
)

df %>% 
  group_by(grp) %>% 
  e_charts(x) %>% 
  e_bar(y) %>% 
  e_aria(enabled = TRUE, decal = list(show = TRUE))

Rounded Corners

head(df, 7) %>% 
  e_charts(x) %>% 
  e_pie(
    y,
    radius = c("40%", "70%"),
    itemStyle = list(
      borderRadius = 20,
      borderColor = '#fff',
      borderWidth = 2
    )
  )

Datazoom Enhancements

Visual improvements to the datazoom feature.

e_charts(mtcars, qsec) %>% 
  e_scatter(mpg, wt) %>%
  e_datazoom(startValue = 14)

Labels

Many improvements to labels were added.

mtcars %>%
  tibble::rownames_to_column("model") %>% 
  e_charts(model) %>% 
  e_bar(
    mpg,
    label = list(
      formatter = '{c} {name|{a}}',
      show = TRUE,
      rotate = 90,
      align = "left",
      verticalAlign = "middle",
      position = "insideBottom",
      rich = list(name = list())
    )
  )

There are also new options such as labelLine and labelLayout.

e_charts(mtcars, mpg) %>% 
  e_scatter(
    qsec,
    wt,
    label = list(
      show = TRUE
    ),
    labelLayout = list(
      x = "95%",
      moveOverlap = "shiftY"
    ),
    labelLine = list(
      show = TRUE,
      lineStyle = list(
        color = "gray"
      )
    ),
    emphasis = list(
      focus = "self"
    )
  ) %>% 
  e_x_axis(min = 9)