diff --git a/src/components/errorbars/index.js b/src/components/errorbars/index.js index a27378ad6e7..0a4acc77fb6 100644 --- a/src/components/errorbars/index.js +++ b/src/components/errorbars/index.js @@ -19,7 +19,7 @@ errorBars.calc = require('./calc'); errorBars.calcFromTrace = function(trace, layout) { var x = trace.x || [], - y = trace.y, + y = trace.y || [], len = x.length || y.length; var calcdataMock = new Array(len); diff --git a/test/jasmine/tests/gl_plot_interact_test.js b/test/jasmine/tests/gl_plot_interact_test.js index d0b5ac0e199..1f227c79bca 100644 --- a/test/jasmine/tests/gl_plot_interact_test.js +++ b/test/jasmine/tests/gl_plot_interact_test.js @@ -968,6 +968,20 @@ describe('Test gl2d plots', function() { .catch(fail) .then(done); }); + + it('should change plot type with incomplete data', function(done) { + Plotly.plot(gd, [{}]); + + expect(function() { + Plotly.restyle(gd, {type: 'scattergl', x: [[1]]}, 0); + }).not.toThrow(); + + expect(function() { + Plotly.restyle(gd, {y: [[1]]}, 0); + }).not.toThrow(); + + done(); + }); }); describe('Test removal of gl contexts', function() {