Learn R Programming

echarts4r (version 0.4.2)

e_legend: Legend

Description

Customise the legend.

Usage

e_legend(e, show = TRUE, type = c("plain", "scroll"), icons = NULL, ...)

Arguments

e

An echarts4r object as returned by e_charts or a proxy as returned by echarts4rProxy.

show

Set to FALSE to hide the legend.

type

Type of legend, plain or scroll.

icons

A optional list of icons the same length as there are series, see example.

...

Any other option to pass, check See Also section.

See Also

Additional arguments

Examples

Run this code
# NOT RUN {
e <- cars |>
  e_charts(speed) |>
  e_scatter(dist, symbol_size = 5)

# with legend
e

# without legend
e |>
  e_legend(show = FALSE)

# with icon
# path is taken from http://svgicons.sparkk.fr/
path <- paste0(
  "path://M11.344,5.71c0-0.73,0.074-1.122,1.199-1.122",
  "h1.502V1.871h-2.404c-2.886,0-3.903,1.36-3.903,3.646",
  "v1.765h-1.8V10h1.8v8.128h3.601V10h2.403l0.32-2.718h",
  "-2.724L11.344,5.71z"
)

e |>
  e_legend(
    icons = list(path)
  )
# }

Run the code above in your browser using DataLab