Skip to content

Commit 3ee2243

Browse files
authored
Merge pull request #271 from anyazz/manual-ranking
Add support for manual ranking
2 parents ccbb66e + 8eba845 commit 3ee2243

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/layout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function updateInputGraph(inputGraph, layoutGraph) {
9797
let graphNumAttrs = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"];
9898
let graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" };
9999
let graphAttrs = ["acyclicer", "ranker", "rankdir", "align"];
100-
let nodeNumAttrs = ["width", "height"];
100+
let nodeNumAttrs = ["width", "height", "rank"];
101101
let nodeDefaults = { width: 0, height: 0 };
102102
let edgeNumAttrs = ["minlen", "weight", "width", "height", "labeloffset"];
103103
let edgeDefaults = {

lib/rank/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,16 @@ module.exports = rank;
2727
* fix them up later.
2828
*/
2929
function rank(g) {
30+
var ranker = g.graph().ranker;
31+
if (ranker instanceof Function) {
32+
return ranker(g)
33+
}
34+
3035
switch(g.graph().ranker) {
3136
case "network-simplex": networkSimplexRanker(g); break;
3237
case "tight-tree": tightTreeRanker(g); break;
3338
case "longest-path": longestPathRanker(g); break;
39+
case "none": break;
3440
default: networkSimplexRanker(g);
3541
}
3642
}

0 commit comments

Comments
 (0)