Skip to content

Commit

Permalink
Merge pull request cBioPortal#57 from cBioPortal/legend-order
Browse files Browse the repository at this point in the history
Make infinity-ordered rules go to end even if other rules dont have order defined
  • Loading branch information
adamabeshouse authored and onursumer committed May 27, 2022
1 parent a2ca593 commit 52f166d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 12 additions & 2 deletions packages/oncoprintjs/dist/oncoprint.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -24404,9 +24404,19 @@ var OncoprintLegendView = (function() {
return labelSort(ruleA, ruleB);
}
} else if (typeof orderA === "undefined") {
return 1; // A comes after B if B has defined order and A doesnt
if (orderB === Number.POSITIVE_INFINITY) {
return -1; // A comes before B regardless, if B is forced to end
} else {
//otherwise, A comes after B if B has defined order and A doesnt
return 1;
}
} else if (typeof orderB === "undefined") {
return -1; // A comes before B if A has defined order and B doesnt
if (orderA === Number.POSITIVE_INFINITY) {
return 1; // A comes after B regardless, if A is forced to end
} else {
// otherwise, A comes before B if A has defined order and B doesnt
return -1;
}
}
});
for (var j=0; j<rules.length; j++) {
Expand Down
14 changes: 12 additions & 2 deletions packages/oncoprintjs/src/js/oncoprintlegendrenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,19 @@ var OncoprintLegendView = (function() {
return labelSort(ruleA, ruleB);
}
} else if (typeof orderA === "undefined") {
return 1; // A comes after B if B has defined order and A doesnt
if (orderB === Number.POSITIVE_INFINITY) {
return -1; // A comes before B regardless, if B is forced to end
} else {
//otherwise, A comes after B if B has defined order and A doesnt
return 1;
}
} else if (typeof orderB === "undefined") {
return -1; // A comes before B if A has defined order and B doesnt
if (orderA === Number.POSITIVE_INFINITY) {
return 1; // A comes after B regardless, if A is forced to end
} else {
// otherwise, A comes before B if A has defined order and B doesnt
return -1;
}
}
});
for (var j=0; j<rules.length; j++) {
Expand Down

0 comments on commit 52f166d

Please sign in to comment.