Learn R Programming

echarts4r (version 0.2.0)

e_sunburst: Sunburst

Description

Build a sunburst.

Usage

e_sunburst(e, parent, child, value, itemStyle, rm_x = TRUE,
  rm_y = TRUE, ...)

e_sunburst_(e, parent, child, value, itemStyle = NULL, rm_x = TRUE, rm_y = TRUE, ...)

Arguments

e

An echarts4r object as returned by e_charts.

parent, child

Edges.

value

Name of column containing values.

itemStyle

Name of column containing styles to pass to child, expects a data.frame or a list, see details.

rm_x, rm_y

Whether to remove x and y axis, defaults to TRUE.

...

Any other option to pass, check See Also section.

Details

The itemStyle argument essentially is a nested data.frame with column names such as color, or borderColor as specified in the official documentation.

See Also

Additional arguments

Examples

Run this code
# 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