Dear friends,
Please review the following code. It produces line race plot (line race with titles).
My question is how a list containing no numerical value when assigned to map mark lines generates numbers.
I would really appreciate if you can explain especially the e_mark_line part and its use.
Thanks in advance.
Parth
CODE
max <- list(
name = "Max",
type = "max"
)
min <- list(
name = "Min",
type = "min"
)
avg <- list(
type = "average",
name = "AVG"
)
mtcars |>
e_charts(mpg) |>
e_line(wt) |>
e_line(drat) |>
e_line(cyl) |>
e_mark_point("wt", data = max) |>
e_mark_point(c("cyl", "drat"), data = min) |>
e_mark_line(data = avg) |> # applies to all
e_mark_area(
serie = "wt",
data = list(
list(xAxis = "min", yAxis = "min"),
list(xAxis = "max", yAxis = "max")
)
)
is because e_mark_line is an argument to the echarts4r object class derived from mtcars, which encapsulates all of the numeric data in mtcars. This illustrates one of the pitfalls of the convenient |> and %>% operators, which is that objects can be implicit.
The signature for e_mark_line
e_mark_line(
e,
serie = NULL,
data = NULL,
...,
title = NULL,
title_position = NULL
)
takes e as its required argument (e is an echart4r object), and that is hidden from view by
How can I use e_mark_line or e_mark_p function to have running marker with the other than avg, min or max. For eg. what I if want to use category labels as line marker?