block by etpinard b1bda979e3cf16011b2cedddd62fe965

Use electron to export plotly.js graphs as images by making requests to an HTTP server.

Full Screen

electron-plotly.js-server

Use electron to export plotly.js graphs as images by making requests to an HTTP server.

How to run this thing?

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

How does this thing work?

Debugging

This gist uses electron@1.7.2 which has an --inspect flag to debug the main.js process using the Chrome devtools.

index.html

electron-plotly.js-server

main.js

package.json

renderer.js

test.js