# NOT RUN {
df <- data.frame(
parent = c("earth", "earth", "earth", "mars", "mars"),
child = c("forest", "ocean", "iceberg", "elon", "curiosity"),
value = ceiling(rnorm(5, 10, 2))
)
df %>%
e_charts() %>%
e_sunburst(parent, child, value) %>%
e_theme("westeros")
# with itemStyle
colors <- c("red", "black", "blue")
df$color <- sample(colors, 5, replace = TRUE)
df$borderColor <- sample(colors, 5, replace = TRUE)
df %>%
tidyr::nest(color, borderColor, .key = "style") %>% # nest
e_charts() %>%
e_sunburst(parent, child, value, style)
# }
Run the code above in your browser using DataLab