Skip to content

Commit

Permalink
Add check to prevent negative branch lengths
Browse files Browse the repository at this point in the history
  • Loading branch information
reagank committed Dec 18, 2023
1 parent 6800b94 commit b182c91
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 123 deletions.
2 changes: 1 addition & 1 deletion dist/tidytree.js
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ var TidyTree = (function () {
.hierarchy(this.data, d => d.children)
.eachBefore(d => {
d.value =
(d.parent ? d.parent.value : 0) + (d.data.length ? d.data.length : 0);
(d.parent ? d.parent.value : 0) + (d.data.length ? Math.abs(d.data.length) : 0);
if (d.value < this.range[0]) this.range[0] = d.value;
if (d.value > this.range[1]) this.range[1] = d.value;
})
Expand Down
2 changes: 1 addition & 1 deletion dist/tidytree.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit b182c91

Please sign in to comment.