Customise the legend.
Usage
e_legend(e, show = TRUE, type = c("plain", "scroll"), icons = NULL, ...)
Arguments
- e
An
echarts4r
object as returned bye_charts
or a proxy as returned byecharts4rProxy
.- show
Set to
FALSE
to hide the legend.- type
Type of legend,
plain
orscroll
.- icons
A optional list of icons the same length as there are series, see example.
- ...
Any other option to pass, check See Also section.
Examples
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)
)