echarts4r
echarts4r copied to clipboard
Connected graphs don't exclude components after saveImage
When I us the tool saveImage
, I want to exclude the saveImage icon from the saved image. With a single unconnected graph that works well. If trying to this with some connected graphs, this icon and its title is printed in the image as well.
This example shows what I mean:
create_chart <- function(data, var){
data %>%
e_charts_(
"mpg",
height = 200
) %>%
e_scatter_(var, name = "Click me!") %>%
e_group("4charts") %>%
e_toolbox(itemSize = 10,feature =
list(saveAsImage =
list( title ="save", show = TRUE, pixelRatio = 5)))
}
e4 <- create_chart(mtcars, "hp")
e5 <- create_chart(mtcars, "wt")
e6 <- create_chart(mtcars, "drat")
e7 <- create_chart(mtcars, "qsec") %>%
e_connect_group("4charts") # connect charts
e_arrange(e4, e5, e6, e7, rows = 2, cols = 2)
Also, when specifically exclude the the icon, it's still in the final image:
create_chart <- function(data, var){
data %>%
e_charts_(
"mpg",
height = 200
) %>%
e_scatter_(var, name = "Click me!") %>%
e_group("4charts") %>%
e_toolbox(itemSize = 10,feature =
list(saveAsImage =
list( title ="save", show = TRUE, pixelRatio = 5,
excludeComponents =
c("toolbox", "legend"))))
}
e4 <- create_chart(mtcars, "hp")
e5 <- create_chart(mtcars, "wt")
e6 <- create_chart(mtcars, "drat")
e7 <- create_chart(mtcars, "qsec") %>%
e_connect_group("4charts") # connect charts
e_arrange(e4, e5, e6, e7, rows = 2, cols = 2)
Could this be a bug or am I doing something wrong?
You're not doing anything wrong but I don't see anything wrong with echarts4r itself: it looks like it might be in ECharts.js itself. I'll try to look into it in a bit more depth when I find the time. Sorry.
Still not a solution for this bug ?