d3 / d3-hierarchy

2D layout algorithms for visualizing hierarchical data.
https://d3js.org/d3-hierarchy
ISC License
1.14k stars 314 forks source link

why non-negative for node.sum #199

Open Benbinbin opened 1 year ago

Benbinbin commented 1 year ago

the documentation say the value function at node.sum(value) must return the non-negative number

The function is passed the node’s data, and must return a non-negative number.

I don't know why limit the return number as a non-negative? I think the nagetive also make sense at some situation.