From 1a1da0d51519b4a4c467454f388c287ec8bc5acb Mon Sep 17 00:00:00 2001 From: Dima Yv Date: Fri, 7 Apr 2017 15:25:11 -0400 Subject: [PATCH 1/3] Cast to empty array --- src/components/errorbars/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 879191dc6c23a2555407ab51e697fa03946a35ac Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 7 Apr 2017 16:42:34 -0400 Subject: [PATCH 2/3] Add test --- test/jasmine/tests/gl_plot_interact_test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/jasmine/tests/gl_plot_interact_test.js b/test/jasmine/tests/gl_plot_interact_test.js index d0b5ac0e199..905a4eebe0f 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 reversibly 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() { From 569d7e5b0f2491f03ab08e31dc98f1b8832dbc50 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 7 Apr 2017 16:46:00 -0400 Subject: [PATCH 3/3] Fix typo --- test/jasmine/tests/gl_plot_interact_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jasmine/tests/gl_plot_interact_test.js b/test/jasmine/tests/gl_plot_interact_test.js index 905a4eebe0f..1f227c79bca 100644 --- a/test/jasmine/tests/gl_plot_interact_test.js +++ b/test/jasmine/tests/gl_plot_interact_test.js @@ -969,7 +969,7 @@ describe('Test gl2d plots', function() { .then(done); }); - it('should reversibly change plot type with incomplete data', function(done) { + it('should change plot type with incomplete data', function(done) { Plotly.plot(gd, [{}]); expect(function() {