diff --git a/draftlogs/6429_fix.md b/draftlogs/6429_fix.md new file mode 100644 index 00000000000..a6f2f8f205a --- /dev/null +++ b/draftlogs/6429_fix.md @@ -0,0 +1 @@ + - Fix line redraw (regression introduced in 2.15.0) [[#6429](https://github.com/plotly/plotly.js/pull/6429)] diff --git a/src/traces/scatter/plot.js b/src/traces/scatter/plot.js index 3a63470687e..6a3bc9ee0d3 100644 --- a/src/traces/scatter/plot.js +++ b/src/traces/scatter/plot.js @@ -248,7 +248,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition revpath = thisrevpath + 'Z' + revpath; } - if(subTypes.hasLines(trace) && pts.length > 1) { + if(subTypes.hasLines(trace)) { var el = d3.select(this); // This makes the coloring work correctly: diff --git a/test/jasmine/tests/scatter_test.js b/test/jasmine/tests/scatter_test.js index 570c13aef9a..d6b537535b0 100644 --- a/test/jasmine/tests/scatter_test.js +++ b/test/jasmine/tests/scatter_test.js @@ -1035,6 +1035,27 @@ describe('end-to-end scatter tests', function() { .then(done, done.fail); }); + it('updates line segments on redraw when having null values', function(done) { + function checkSegments(exp, msg) { + var lineSelection = d3Select(gd).selectAll('.scatterlayer .js-line'); + expect(lineSelection.size()).toBe(exp, msg); + } + + Plotly.newPlot(gd, [{ + y: [1, null, 2, 3], + mode: 'lines+markers' + }]) + .then(function() { + checkSegments(2, 'inital'); + + return Plotly.relayout(gd, 'xaxis.range', [0, 10]); + }) + .then(function() { + checkSegments(2, 'after redraw'); + }) + .then(done, done.fail); + }); + it('correctly autoranges fill tonext traces across multiple subplots', function(done) { Plotly.newPlot(gd, [ {y: [3, 4, 5], fill: 'tonexty'},