-
Notifications
You must be signed in to change notification settings - Fork 19.8k
Add property to define size of a node in Sankey Chart #11644
Copy link
Copy link
Closed
Labels
Description
What problem does this feature solve?
In the current implementation the node size in a Sankey chart is determined by the bigger number of incoming or outgoing edges. Our case involves a node size that is actually bigger than the connections between the nodes:
What does the proposed API look like?
An optional new property size on the nodes' properties could offer a clean option to define the node's size
{
"nodes": [
{
"name": "a1",
"size": 100
}
...To get the node's size in the chart could then be determined by whatever is bigger: the sum of incoming and outgoing edges or the node's defined size in
function computeNodeValues(nodes) {
zrUtil.each(nodes, function (node) {
var value1 = sum(node.outEdges, getEdgeValue);
var value2 = sum(node.inEdges, getEdgeValue);
var value = Math.max(value1, value2, node.size); // <-- node.size here
node.setLayout({
value: value
}, true);
});
}Reactions are currently unavailable
