Code Monkey home page Code Monkey logo

Comments (5)

JohnCoene avatar JohnCoene commented on May 22, 2024 1

Answering your questions in reverse order,I have added the ability to render as SVG.

  1. reinstall the package devtools::install_github("JohnCoene/echarts4r")
  2. Set renderer="svg" in e_charts

Even using svg the visualisation requires the libraries (<script></script>) so I'm unsure it will help including them in Word document.

However, I see two options to include them in Word.

  1. Open you visualisation in your browser, echarts4r default to will width and height of your screen so the resulting screen shot might be clearer. If you're in RStudio, check the top of the Viewer, there's a button to open in browser.
  2. Use the built-in save as image tool, it might also return a clearer image.
library(echarts4r)

USArrests %>% 
  e_charts(UrbanPop) %>% 
  e_line(Assault) %>% 
  e_toolbox_feature(feature = c("saveAsImage")) # adds ability to save plot as image in the top right

Normally you would not save the plot as an image, you would save the whole widget.

# plot as object
USArrests %>% 
  e_charts(UrbanPop) %>% 
  e_line(Assault) -> plot

# save plot
htmlwidgets::saveWidget(plot, file = "plot.html")

Let me know if this is unclear, please close if this answers your question.

from echarts4r.

DongZhang1103 avatar DongZhang1103 commented on May 22, 2024 1

Thank you sou much. So great!

from echarts4r.

ilona-grabowicz avatar ilona-grabowicz commented on May 22, 2024

@JohnCoene Could you please add a functionality to be able to save the images?? For me it is a big disadvantage that these plots cannot be saved easily to png, for example. The png() -> plot -> dev.off() doesn't work either.

from echarts4r.

JohnCoene avatar JohnCoene commented on May 22, 2024

These are interactive charts that are ultimately meant for HTML outputs and it's difficult to provide an automated/reproducible way to save them as PNG, there is an old opened issue on htmlwidgets on the topic. I'm afraid webshot does not work properly with echarts4r so I?m out of solutions at this stage.

from echarts4r.

rdatasculptor avatar rdatasculptor commented on May 22, 2024

Webshot2 works like a charm.

from echarts4r.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.