Skip to contents

Helper for creating a pie chart

Usage

bb_piechart(bb, data, mapping = NULL, ...)

Arguments

bb

A `billboard` `htmlwidget` object.

data

A `data.frame`, first column should contain labels, second column values associated, except if mapping is provided.

mapping

Mapping of variables on the chart, see [bbaes()].

...

Arguments for slot pie, <https://naver.github.io/billboard.js/release/latest/doc/Options.html#.pie>.

Value

A `billboard` `htmlwidget` object.

Note

This function can be used with [billboarderProxy()] in Shiny applications.

Examples

stars <- data.frame(
  package = c("billboarder", "ggiraph", "officer", "shinyWidgets", "visNetwork"),
  stars = c(9, 177, 43, 44, 169)
)

# Default
billboarder() %>%
  bb_piechart(data = stars)
# Explicit mapping billboarder() %>% bb_piechart(data = stars, bbaes(package, stars))
# Other way to specify mapping billboarder(data = stars) %>% bb_aes(package, stars) %>% bb_piechart()