how to use plotly.js in a node application
I know it is very late but if you still haven't figured it how. Here it is: Just use the ID name instead of query selecting it.
Plotly.newPlot("myChart", traces, layout)
Keep the plotly JS file on the front end and render there. Just use node to prep your data and send it over.
Personally I prep the entire data
of Plotly.newPlot('myDiv', data);
in node then get client to request for it, so I can control the looks of the plot server side.
Plotly for Node (https://plot.ly/nodejs/) allows you to connect to a plotly server and display your graph online via their API (this requires an account and API key with Plotly) The exception to this is that is you / your company has plotly on-premises server running.
Plotly JS is the actual library that allows you to plot on your own server.
Only reason to install the node version is to allow code completion inside node