代码之家  ›  专栏  ›  技术社区  ›  Bangyou

echarts4r默认隐藏系列的一部分

  •  1
  • Bangyou  · 技术社区  · 9 月前

    如果我有一个由echarts4r制作的数字,如下所示

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

    它将产生一个下图。

    enter image description here

    有关详细信息,请参见此处: https://echarts4r.john-coene.com/articles/advanced

    我想默认隐藏系列的一部分(例如。 setosa )看起来是这样的

    enter image description here

    我怎样才能做到这一点?

    1 回复  |  直到 9 月前
        1
  •  1
  •   Julian    9 月前

    你可以使用 selected = list('setosa' = FALSE) (其他系列默认为true):

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