Search code examples
recharts4r

echarts4r hides part of series in default


If I have a figure produced by echarts4r as follows

iris |> 
  group_by(Species) |> 
  e_charts(Sepal.Length) |> 
  e_line(Sepal.Width) |> 
  e_title("Grouped data")

It will produce a figure below.

enter image description here

See here for details: https://echarts4r.john-coene.com/articles/advanced

I would like to hide part of series in default (e.g. setosa) which will looks like this

enter image description here

How could I achieve this?


Solution

  • you can use selected = list('setosa' = FALSE) (the other series are true by default):

    library(echarts4r)
    
    iris |> 
      group_by(Species) |> 
      e_charts(Sepal.Length) |> 
      e_line(Sepal.Width) |> 
      e_title("Grouped data") |> 
      e_legend(selected = list('setosa' = FALSE))