0

According to echarts4r::e_sunburst help page you can use either "json list hierarchical data representation" which seem to be simply a list or a "tibble hierarchical data representation".

The data.tree::ToListExplicit function seems to be able to transform Node objects from package data.tree into lists but it does not seem to work with echarts out of the box.

For example I would expect the following code to provide a graph :

library(data.tree)
library(echarts4r)
data(acme)
acme |> 
    ToListExplicit(unname = TRUE) |>
    e_charts() |> 
    e_tree(initialTreeDepth = 3)

According the this discussion on github I would expect this to provide a graph :

acme |> 
    e_charts() |> 
    e_sunburst()

And with this approach I get only a partial graph with the first subnode :

jsonl <- acme |> ToListExplicit(unname = TRUE)
jsonl$children|> 
    e_charts() |> 
    e_tree(initialTreeDepth = 3)

Gilles San Martin
  • 4,224
  • 1
  • 18
  • 31

0 Answers0