-
Notifications
You must be signed in to change notification settings - Fork 20
Exporting of Charts
Prakriti Gupta edited this page Jul 13, 2018
·
2 revisions
Through this feature, a user can export the HighChart in various formats (PDF, PNG, JPEG, and SVG) using the code. Default value is PNG.
To export a HighChart follow these steps:
- Add the line
plot.export(export_type, file_name)
after generating the Daru::View::Plot object. - That's it. Sit back and enjoy. :)
For example, using only these four lines in rails:
We can download all the four HighStocks simultaneously.
- Exporting in web frameworks is completely offline. In IRuby notebook, offline-export supports only the exporting to png, jpeg and svg format. Export to PDF is not working (not even through the exporting button in highchart). So, online exporting is done in IRuby notebook. There is a problem in online exporting that if we run-all all the cells of IRuby notebook then only the last chart will be exported. Individually, running the cells works fine.
- Right now, using
plot.export(export_type, file_name)
in the terminal produces the script to download it. One way we can export the chart using terminal is that we can export the code to a file and then automatically open it in the browser. This will show the popup to download the chart in browser. For this, we first need to find out a way to differentiate whether the user is working on console or web framework/IRuby notebook.