You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm plotting a chart with multiple bars and need to stack them in one order, and display the legend in another. I thought I could rearrange the legend data by supplying the data argument, but that actually creates a separate data object in the JSON.
I've found a workaround by modifying the data in the saved object, and then it gives the expected result. Here's a reproducible example:
library(echarts4r)
dataset <- data.frame(
categories = letters[1:5],
smaller = 1:5,
larger = 21:25
)
my_chart <- e_charts(dataset, x = categories) %>%
e_bar(serie = larger, name = "Big") %>%
e_bar(serie = smaller, name = "Small") %>%
e_legend(data = list("Small", "Big"))
# This one creates two "data"s
my_chart
my_chart %>% e_inspect()
# This reorganises as wanted
my_chart$x$opts$legend$data <- list("Small", "Big")
my_chart
Is there a way to reorganise the data by providing the list directly to e_legend, instead of modifying a chart stored as an object?
The text was updated successfully, but these errors were encountered:
Hi,
I'm plotting a chart with multiple bars and need to stack them in one order, and display the legend in another. I thought I could rearrange the legend data by supplying the
data
argument, but that actually creates a separate data object in the JSON.I've found a workaround by modifying the data in the saved object, and then it gives the expected result. Here's a reproducible example:
Is there a way to reorganise the data by providing the list directly to e_legend, instead of modifying a chart stored as an object?
The text was updated successfully, but these errors were encountered: