hc_legend: Legend options for highcharter objects

Description Usage Arguments Details Examples

View source: R/highcharts-api.R

Description

The legend is a box containing a symbol and name for each series item or point item in the chart. Each series (or points in case of pie charts) is represented by a symbol and its name in the legend. It is possible to override the symbol creator function and create custom legend symbols.

Usage

1

Arguments

hc

A highchart htmlwidget object.

...

Arguments defined in https://api.highcharts.com/highcharts/legend.

Details

A Highmaps legend by default contains one legend item per series, but if a colorAxis is defined, the axis will be displayed in the legend. Either as a gradient, or as multiple legend items for dataClasses.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
highchart() %>%
  hc_xAxis(categories = month.abb) %>%
  hc_add_series(name = "Tokyo", data = sample(1:12)) %>%
  hc_add_series(name = "London", data = sample(1:12) + 10) %>%
  hc_add_series(name = "Other City", data = sample(1:12) + 20) %>%
  hc_legend(
    align = "left",
    verticalAlign = "top",
    layout = "vertical",
    x = 0,
    y = 100
  )

highcharter documentation built on Jan. 3, 2022, 5:08 p.m.