Skip to content

Parcoords bug fix - do not draw full select line when constraint range falls below range #4083

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

Merged
merged 3 commits into from
Jul 29, 2019
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
10 changes: 2 additions & 8 deletions src/traces/parcoords/axisbrush.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function setHighlight(d) {
if(!d.brush.filterSpecified) {
return '0,' + d.height;
}

var pixelRanges = unitToPx(d.brush.filter.getConsolidated(), d.height);
var dashArray = [0]; // we start with a 0 length selection as filter ranges are inclusive, not exclusive
var p, sectionHeight, iNext;
Expand All @@ -102,7 +103,7 @@ function setHighlight(d) {

function unitToPx(unitRanges, height) {
return unitRanges.map(function(pr) {
return pr.map(function(v) { return v * height; }).sort(sortAsc);
return pr.map(function(v) { return Math.max(0, v * height); }).sort(sortAsc);
});
}

Expand Down Expand Up @@ -270,13 +271,6 @@ function attachDragBehavior(selection) {
var topViolation = Math.max(0, s.newExtent[1] - 1);
s.newExtent[0] += bottomViolation;
s.newExtent[1] -= topViolation;
if(s.grabbingBar) {
// in case of bar dragging (non-resizing interaction, unlike north/south resize or new bar creation)
// the constraint adjustment must apply to the other end of the bar as well, otherwise it'd
// shorten or lengthen
s.newExtent[1] += bottomViolation;
s.newExtent[0] -= topViolation;
}

d.brush.filterSpecified = true;
s.extent = s.stayingIntervals.concat([s.newExtent]);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
154 changes: 154 additions & 0 deletions test/image/mocks/gl2d_parcoords_out-of-range_selected-below.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
{
"data": [
{
"type": "parcoords",
"dimensions": [
{
"label": "A+1",
"range": [
1,
2
],
"constraintrange": [
1.25,
1.75
],
"values": [
1,
1.25,
1.5,
1.75,
2
]
},
{
"label": "2A",
"range": [
0,
2
],
"constraintrange": [
0.5,
1.5
],
"values": [
0,
0.5,
1,
1.5,
2
]
},
{
"label": "A",
"range": [
0,
1
],
"constraintrange": [
0.25,
0.75
],
"values": [
0,
0.25,
0.5,
0.75,
1
]
},
{
"label": "Above",
"range": [
0,
1
],
"constraintrange": [
0.25,
1.25
],
"values": [
0,
0.25,
0.5,
0.75,
1
]
},
{
"label": "Below",
"range": [
0,
1
],
"constraintrange": [
-0.25,
0.75
],
"values": [
0,
0.25,
0.5,
0.75,
1
]
},
{
"label": "2/above",
"range": [
0,
1
],
"constraintrange": [
[
0.25,
0.5
],
[
0.75,
1.25
]
],
"values": [
0,
0.25,
0.5,
0.75,
1
]
},
{
"label": "2/below",
"range": [
0,
1
],
"constraintrange": [
[
-0.25,
0.25
],
[
0.5,
0.75
]
],
"values": [
0,
0.25,
0.5,
0.75,
1
]
}
]
}
],
"layout": {
"width": 600,
"height": 400,
"title": {
"text": "Should display & select constraintrange below/above ranges"
}
}
}