I’m getting started in plotly and I have a problem: browser display:
plotly-latest.min.js:32 Uncaught Error: DOM element provided is null or undefinedn @ plotly-latest.min.js:32P.plot @ plotly-latest.min.js:33(anonymous function) @ dashboard.php:76
I follow the step by step site, can anybody help me?
You must calling Plotly.plot
wrong. In:
Plotly.plot(graph, data, layout);
graph
can be the string id of the <div>
element you want to plot in e.g.
<script src="plotly.js"></script>
<div id="graph"></graph>
<script>
// creates plotly.js graph in <div> above
Plotly.plot('graph', data, layout);
</script>
graph
can also be the DOM element itself e.g.
<script src="plotly.js"></script>
<div id="graph"></graph>
<script>
var graph = document.getElementById('graph');
// creates plotly.js graph in <div> above
Plotly.plot(graph, data, layout);
</script>
I put after the div and it worked. Tks