Skip to content

Commit e8df1bf

Browse files
committed
include (optional) node.value in the max calc
1 parent 4490811 commit e8df1bf

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Diff for: src/sankey.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,11 @@ export default function() {
132132
// Compute the value (size) of each node by summing the associated links.
133133
function computeNodeValues(graph) {
134134
graph.nodes.forEach(function(node) {
135-
if ( typeof node.value === 'undefined' ) {
136-
node.value = Math.max(
137-
sum(node.sourceLinks, value),
138-
sum(node.targetLinks, value)
139-
);
140-
}
135+
node.value = Math.max(
136+
sum(node.sourceLinks, value),
137+
sum(node.targetLinks, value),
138+
typeof node.value !== 'undefined' ? node.value : 0
139+
);
141140
});
142141
}
143142

0 commit comments

Comments
 (0)