Learn R Programming

highcharter (version 0.9.4)

hc_legend: Legend options for highcharter objects

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

hc_legend(hc, ...)

Arguments

hc

A highchart htmlwidget object.

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

Run this code
# NOT RUN {
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
  )
# }

Run the code above in your browser using DataLab