Skip to content

Commit a709417

Browse files
authored
Merge pull request #6429 from plotly/fix6407-line-redraw
Fix line redraw
2 parents b03f295 + d6bd87c commit a709417

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

draftlogs/6429_fix.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fix line redraw (regression introduced in 2.15.0) [[#6429](https://github.com/plotly/plotly.js/pull/6429)]

src/traces/scatter/plot.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
248248
revpath = thisrevpath + 'Z' + revpath;
249249
}
250250

251-
if(subTypes.hasLines(trace) && pts.length > 1) {
251+
if(subTypes.hasLines(trace)) {
252252
var el = d3.select(this);
253253

254254
// This makes the coloring work correctly:

test/jasmine/tests/scatter_test.js

+21
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,27 @@ describe('end-to-end scatter tests', function() {
10351035
.then(done, done.fail);
10361036
});
10371037

1038+
it('updates line segments on redraw when having null values', function(done) {
1039+
function checkSegments(exp, msg) {
1040+
var lineSelection = d3Select(gd).selectAll('.scatterlayer .js-line');
1041+
expect(lineSelection.size()).toBe(exp, msg);
1042+
}
1043+
1044+
Plotly.newPlot(gd, [{
1045+
y: [1, null, 2, 3],
1046+
mode: 'lines+markers'
1047+
}])
1048+
.then(function() {
1049+
checkSegments(2, 'inital');
1050+
1051+
return Plotly.relayout(gd, 'xaxis.range', [0, 10]);
1052+
})
1053+
.then(function() {
1054+
checkSegments(2, 'after redraw');
1055+
})
1056+
.then(done, done.fail);
1057+
});
1058+
10381059
it('correctly autoranges fill tonext traces across multiple subplots', function(done) {
10391060
Plotly.newPlot(gd, [
10401061
{y: [3, 4, 5], fill: 'tonexty'},

0 commit comments

Comments
 (0)