madlogos / recharts

An R Interface to Baidu ECharts2 Library
http://madlogos.github.io/recharts
Other
88 stars 64 forks source link

How to use recharts make static image? #28

Closed slsongge closed 5 years ago

slsongge commented 5 years ago

I want use recharts to make static images, because i need to save lots of images. Thanks!

madlogos commented 5 years ago

recharts is built on top of htmlwidgets, so you can save the recharts object to a .html file, then convert it to image using webshot. You can refer to https://stackoverflow.com/questions/45298144/convert-html-output-to-image. By now, Echarts2 does not support a better way to export the static image. Echarts4 has a echartInstance.getDataUrl method, which is a good solution. But not supported here.