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.

hc_legend(hc, ...)

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

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 )