I have a node application. I installed plotly with npm install plotly, then in my node app script I require it:
var plotly = require('plotly')`
However, I do not know how to get the document element Id, which normally on the client side is fine to get, and can be passed to Plotly.newPlot:
var gd = document.getElementById("myChart")
...
Plotly.newPlot(gd, traces, layout)
I have tried with jsdom but got no luck.
Or is it better practice to keep all the plotly stuff on the front-end and just call it as:
<script src="/js/myplots.js"></script>
instead of trying to integrate with node? My intention is to render charts on the front-end