Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Plotly.js in node.js

Hello.

I’m trying to integrate plotly.js in a project with a front made with Ext.JS 4 and a back with Node.js.

I found out that plotly.js was on npm, so I downloaded it through npm and it’s 35 dependencies but I can’t get it working when I’m writing this :

PlotlyUtils = {
    getPlotly: function(o, cb) {
        try {
            var plotly = PlotlyUtils.using("plotly.js");
        }
        catch (e) {
            console.log(e);
        }
        cb(plotly);
    }
}

module.exports = PlotlyUtils;

I’m catching an error saying that “document is not defined”, I guess intialize Plotly make him to search for the current document, but how I’m supposed to do this working knowing the fact that my Ext.JS front has to call the node.js service to get a Plotly instance and use it’s methods?

Sorry for my question I’m not expert at all in both Ext.JS and Node.js technologies and english is not my mother tongue so I’m doing my best to be understandable :smiley: . Thanks in advance for your concern

plotly.js is a browser-only package at the moment.

We hope to make plotly.js compatible with node.js at some point in the near future.

Subscribe to https://github.com/plotly/plotly.js/issues/437 for the latest development information.

thanks you very much for your answer Etienne !