Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix line redraw #6429

Merged
merged 3 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/traces/scatter/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
21 changes: 21 additions & 0 deletions test/jasmine/tests/scatter_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
Expand Down