Skip to content
New issue

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

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

Already on GitHub? # to your account

discard ranges for single value parcoords dimensions when drag a new axis range #4878

Merged
merged 2 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions src/traces/parcoords/axisbrush.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,15 @@ function dedupeRealRanges(intervals) {
}
result.push(currentInterval);
}

if(
result.length === 1 &&
result[0][0] > result[0][1]
) {
// discard result
result = [];
}

return result;
}

Expand Down
44 changes: 44 additions & 0 deletions test/jasmine/tests/parcoords_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,50 @@ describe('parcoords constraint interactions - without defined axis ranges', func
.catch(failTest)
.then(done);
});

it('@noCI @gl should keep single point dimension selected', function(done) {
var testLayer = '.gl-canvas-focus';

Plotly.newPlot(gd, {
data: [
{
type: 'parcoords',
line: {
color: 'blue'
},

dimensions: [{
label: 'A',
values: [0, 1]
}, {
label: 'B',
values: [2, 2],
tickvals: [2],
ticktext: ['single point']
}]
}
],
layout: {
width: 400,
height: 400,
margin: {t: 100, b: 100, l: 100, r: 100}
}
})
.then(function() {
// select
mostOfDrag(295, 250, 295, 150);
mouseEvent('mouseup', 295, 150);
})
.then(delay(snapDelay))
.then(function() {
var rgb = getAvgPixelByChannel(testLayer);

expect(rgb[0]).toBe(0, 'no red');
expect(rgb[2]).not.toBe(0, 'all blue');
})
.catch(failTest)
.then(done);
});
});

describe('parcoords constraint interactions - with defined axis ranges', function() {
Expand Down