Skip to content

Commit

Permalink
refactor(Vis View): 🚧 Porgress on tidyTree
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Aug 6, 2021
1 parent 14ee9d0 commit ccbdf2f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Visualisations/TidyTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,22 @@ export const tidyTree = (
const adjList: AdjListItem[] = bfsAdjList(graph, currFile.basename);
console.log({ adjList });

const noDoubles = [...adjList];
noDoubles.forEach((a, i, list) => {
if (list.some((b, j) => i !== j && a.parentId === b.parentId)) {
noDoubles.splice(i, 1);
}
});
console.log({ noDoubles });

const tree = (data) => {
const root = d3.hierarchy(data);
root.dx = 10;
root.dy = width / (root.height + 1);
return d3.tree().nodeSize([root.dx, root.dy])(root);
};

const root = tree(stratify(adjList));
const root = tree(stratify(noDoubles));
console.log(root);

let x0 = Infinity;
Expand Down

0 comments on commit ccbdf2f

Please sign in to comment.