79602727

Date: 2025-05-02 02:11:03
Score: 1
Natty:
Report link

Tim G, in the comments, points out that there is an easier data structure now that can be used for the sunburst plot.

https://github.com/JohnCoene/echarts4r/issues/207#issuecomment-718524703

df <- data.frame(parents = c("","earth", "earth", "mars", "mars", "land", "land", "ocean", "ocean", "fish", "fish", "Everything", "Everything", "Everything"),
                 labels = c("Everything", "land", "ocean", "valley", "crater", "forest", "river", "kelp", "fish", "shark", "tuna", "venus","earth", "mars"),
                 value = c(0, 30, 40, 10, 10, 20, 10, 20, 20, 8, 12, 10, 70, 20))

# create a tree object
universe <- data.tree::FromDataFrameNetwork(df)

# use it in echarts4r
universe %>% 
  e_charts() %>% 
  e_sunburst()
Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Gingie