Use electron to export plotly.js graphs as images by making requests to an HTTP server.
npm i
npm start &
(starts server)npm test
(makes request to server, saves image from response)If you're on Ubuntu (or maybe some other Linux distro) and you have
xvfb
installed,
you can run this things headlessly (no joke) with:
npm run start:headless
and see results in 0.png
.
You can also pass as argument any URL to a plotly "data"/"layout"
JSON or the
name of the plotly.js test
mock you'd
like to export. For example:
npm test -- 12 20 gl3d_bunny geo_first gl2d_parcoords
electron-plotly.js
for more info.This gist uses electron@1.7.2
which has an --inspect
flag to debug the
main.js
process using the Chrome devtools.