Black Lives Matter. Please consider donating to Black Girls Code today.
https://www.blackgirlscode.com

How to perform server side manipulation using Plotly.js

Dear Community members,
I am currently working with a large amount of data to be rendered using Plotly.js. I have seen that using D3.js one can try to do manipulation on the server side to avoid the DOM nodes taking a lot of time and avoid making the browser crash or not responding for a certain time. I was wondering if there is something that I can do when using Plotly.js and put the computation on the server-side (i.e., voiding client-side computing) to avoid crashing/not responding browser and making client-side less computation intensive?

(P.S., I refered to an article: Pre-render d3.js charts at server side part1: proof of concept, url: http://mango-is.com/blog/engineering/pre-render-d3-js-charts-at-server-side.html)

Looking forward to your kind response.
Saad

Here are a few options:

Unfortunately, plotly.js is not fully functional in node.js (even with jsdom) at the moment (our latest attempt is here, if you’re interested), but we are planning on getting it to work at some point.

Hello Etienne, I don’t know if it’s correct to ask here, if not my apologizes, but I’m really interested about server side pdf rendering with plotly, I don’t know where to check about news on that topic?

Best regards.

The most solid option would https://gist.github.com/etpinard/d27a44bd5dbee5490f20 at the moment.

nw.js can be run headlessly on servers. See instructions here.

The above gist does not support PDF exports, but this should be easy to add using a third-party library e.g:

We won’t put any serious work into making plotly.js compatibly in node.js until jsdom adds support for browser objects we currently use in plotly.js. See https://github.com/tmpvar/jsdom/issues/1368 for more information.

I hope this helps.

1 Like

Is there any performance difference between running plotly on nw and plotly on browser? Isn’t nw like a chrome wrapper?

There shouldn’t be.

Yep, it’s a chromium wrapper to be more precise.

Users watching this ticket might be interested in:

where I tired plotly.js with run-headless-chromium and it worked great.