source:
node_modules/d3-hierarchy/src/hierarchy/sum.js@
a762898
| Last change on this file since a762898 was e4c61dd, checked in by , 6 months ago | |
|---|---|
|
|
| File size: 264 bytes | |
| Line | |
|---|---|
| 1 | export default function(value) { |
| 2 | return this.eachAfter(function(node) { |
| 3 | var sum = +value(node.data) || 0, |
| 4 | children = node.children, |
| 5 | i = children && children.length; |
| 6 | while (--i >= 0) sum += children[i].value; |
| 7 | node.value = sum; |
| 8 | }); |
| 9 | } |
Note:
See TracBrowser
for help on using the repository browser.
