Repository navigation
Plotly relayout issue when changing height on histograms #2020
Description
Activity
It's a bit difficult to understand the problem. I've cleaned up your input for readability, but could you fork and modify this codepen to demonstrate the issue? Thanks! https://codepen.io/rsreusser/pen/ZXWLxy?editors=1010
(Also,
plotly-latest.min.jsis effectively useless for stack traces. plotly-latest.js is much more helpful.)Reacted by popepayAh, thanks for cleaning up the issue a bit! I can now reproduce the issue here: https://codepen.io/rsreusser/pen/ZXWLxy?editors=1010
@rreusser Thank you for the very prompt response!
I have updated the Original Post with a working example (which is identical to the non-working but has the 2nd trace removed)
No problem. Here's a much more minimal reproduction that shows the same issue:
Plotly.plot('graph', [{ "type": "histogram", "x": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], }, { "type": "histogram", "x": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4], }]).then(function () { return Plotly.relayout('graph', {width: 500}); });
Stack trace:
plotly-latest.js:168259 Uncaught (in promise) TypeError: Cannot read property 'length' of undefined at Object.calc (plotly-latest.js:168259) at Object.plots.doCalcdata (plotly-latest.js:152035) at Object.Plotly.plot (plotly-latest.js:130164) at Object.plots.doAutoMargin (plotly-latest.js:151326) at Object.plots.supplyDefaults (plotly-latest.js:150322) at Object.Plotly.plot (plotly-latest.js:130133) at exports.layoutReplot (plotly-latest.js:134268) at Object.lib.syncOrAsync (plotly-latest.js:126168) at Object.relayout (plotly-latest.js:131883) at pen.js:8The issue seems to be with the lines:
var nMax = size.length; // bin the data for(i = 0; i < pos0.length; i++) { n = Lib.findBin(pos0[i], bins); if(n >= 0 && n < nMax) total += binFunc(n, i, size, rawCounterData, counts); }
Though I'm having trouble figuring out exactly what the problem is via the chrome debugger alone. Seems to happen only when two histogram traces are present, not just one. Thoughts, @alexcjohnson?
Source of the error seems like this neighborhood in
histogram/calc.js.Reacted by popepay@popepay The cause isn't 100% clear yet, but hopefully it's at least fairly easy to solve at this point. Thanks for helping clarify! Definitely seems like something's not quite right though. Probably won't get resolved in the next couple hours, but hopefully should be able to get it fixed pretty quickly and released pretty soon.
Reacted by popepay- added a commit that references this issue
on Sep 20, 2017 Is there anything I should do to update https://cdn.plot.ly/plotly-latest.js / plotly-min.js ?
Or will someone take care of this?thanks again for finding the glitch!
Is there anything I should do to update https://cdn.plot.ly/plotly-latest.js / plotly-min.js ?
Wait until
v1.31.0is out.
Hello,
I noticed a strange issue when changing the height of that particular plot.
Link to example (working & non-working):
https://codepen.io/cariacou/pen/VMapvo
Source of the error seems to be that pos0 is undefined
Thanks to @rreusser for helping me through the bug reporting. Now the post should be a lot more readable.
I have updated this post with the work he did in order to have all the information in one place