Skip to contents

Set legend options

Usage

v_specs_legend(vc, ..., add = FALSE)

Arguments

vc

An htmlwidget created with vchart().

...

Options for the legend, see examples or online documentation.

add

Add the legend to exiting ones or overwrite all previous legends.

Value

A vchart() htmlwidget object.

Examples

library(vchartr)
data("mpg", package = "ggplot2")

vchart(table(Class = mpg$class, Year = mpg$year)) %>%
  v_bar(aes(Class, Freq, fill = Year)) %>%
  v_specs_legend(
    title = list(text = "Title", visible = TRUE),
    orient = "right",
    position = "start",
    item = list(focus = TRUE)
  )