Black Lives Matter. Please consider donating to Black Girls Code today.

makeTemplate example?

Hello,

I’m trying to use the makeTemplate method but I’m getting a stack overflow with even the simplest of plots.

plotly-latest.min.js:7 Uncaught RangeError: Maximum call stack size exceeded
at a (plotly-latest.min.js:7)
at a (plotly-latest.min.js:7)
at a (plotly-latest.min.js:7)
at a (plotly-latest.min.js:7)
at a (plotly-latest.min.js:7)
at a (plotly-latest.min.js:7)
at a (plotly-latest.min.js:7)
at a (plotly-latest.min.js:7)
at a (plotly-latest.min.js:7)
at a (plotly-latest.min.js:7)

Here’s a very simple codepen based on the getting started plot:

Thanks Greg

OK I see I just need to pass an object with just the data and layout, not the result of document.getElementById.

var p = {
  data: {},
  layout: {}
}
p.data = TESTER.data;
p.layout = TESTER.layout;
console.log('Calling makeTemplate  :');
obj.template = Plotly.makeTemplate(p);

We’re working on some documentation for templates at the moment.

In the meantime, you can try to look at our test cases:

to make sense of it all.