Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading