Skip to content

Commit be70865

Browse files
authored
Merge pull request #4878 from plotly/fix4831-parcoords
discard ranges for single value parcoords dimensions when drag a new axis range
2 parents 05fd22f + 5c18894 commit be70865

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

src/traces/parcoords/axisbrush.js

+9
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,15 @@ function dedupeRealRanges(intervals) {
453453
}
454454
result.push(currentInterval);
455455
}
456+
457+
if(
458+
result.length === 1 &&
459+
result[0][0] > result[0][1]
460+
) {
461+
// discard result
462+
result = [];
463+
}
464+
456465
return result;
457466
}
458467

test/jasmine/tests/parcoords_test.js

+44
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,50 @@ describe('parcoords constraint interactions - without defined axis ranges', func
15551555
.catch(failTest)
15561556
.then(done);
15571557
});
1558+
1559+
it('@noCI @gl should keep single point dimension selected', function(done) {
1560+
var testLayer = '.gl-canvas-focus';
1561+
1562+
Plotly.newPlot(gd, {
1563+
data: [
1564+
{
1565+
type: 'parcoords',
1566+
line: {
1567+
color: 'blue'
1568+
},
1569+
1570+
dimensions: [{
1571+
label: 'A',
1572+
values: [0, 1]
1573+
}, {
1574+
label: 'B',
1575+
values: [2, 2],
1576+
tickvals: [2],
1577+
ticktext: ['single point']
1578+
}]
1579+
}
1580+
],
1581+
layout: {
1582+
width: 400,
1583+
height: 400,
1584+
margin: {t: 100, b: 100, l: 100, r: 100}
1585+
}
1586+
})
1587+
.then(function() {
1588+
// select
1589+
mostOfDrag(295, 250, 295, 150);
1590+
mouseEvent('mouseup', 295, 150);
1591+
})
1592+
.then(delay(snapDelay))
1593+
.then(function() {
1594+
var rgb = getAvgPixelByChannel(testLayer);
1595+
1596+
expect(rgb[0]).toBe(0, 'no red');
1597+
expect(rgb[2]).not.toBe(0, 'all blue');
1598+
})
1599+
.catch(failTest)
1600+
.then(done);
1601+
});
15581602
});
15591603

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

0 commit comments

Comments
 (0)