echarts4r icon indicating copy to clipboard operation
echarts4r copied to clipboard

Saveimage not working with echarts5

Open ghost opened this issue 4 years ago • 3 comments

SaveImage no longer working with new update.

ghost avatar Feb 09 '21 22:02 ghost

Would you have a reproducible example? It works on my tests.

JohnCoene avatar Feb 19 '21 21:02 JohnCoene

I think I ran into the same problem (or at least comparable) :).

I have reproducible example for you:

df <- data.frame(
  x = LETTERS[1],
  group = c(1,1,1,2,2,2),
  a = c(1,0,0,1,1,1),
  b = c(1,0,1,0,1,1),
  c = c(0,1,1,1,1,0)
)


df %>% group_by(group) %>%
  e_charts(x, timeline = TRUE) %>% 
  e_bar(a, stack = "grp") %>% 
  e_bar(b, stack = "grp") %>% 
  e_bar(c, stack = "grp") %>%
  e_hide_grid_lines() %>%
  e_toolbox(itemSize = 10,feature = 
                    list(saveAsImage = 
                           list( title ="Save!", show = TRUE, pixelRatio = 5,
                                 excludeComponents = 
                                   c("timeline"))))
        

If you use e_toolbox_feature(feature = "saveAsImage") it just works as expected, but if you use

  e_toolbox(itemSize = 10,feature = 
                    list(saveAsImage = 
                           list( title ="Save!", show = TRUE, pixelRatio = 5,
                                 excludeComponents = 
                                   c("timeline"))))

instead, the image saving doesn't work.

rdatasculptor avatar Mar 05 '21 12:03 rdatasculptor

Hi @JohnCoene, I may be wrong, but I've also recently run into this issue and I think it may be device / renderer specific due to this upstream issue with pixel ratio: https://github.com/apache/echarts/issues/14179

jonmcalder avatar Apr 07 '21 09:04 jonmcalder