Skip to content

Limit to single open branch in ForceDirectedSeries

This demo shows how we can use setting-bound event to limit open branches in ForceDirectedSeries to one.

The following code ensures that all open branches are collapsed, when another branch is expanded.

series.nodes.template.on("disabled", function(disabled, targetNode) {
let targetLevel = targetNode.dataItem.get("depth");
if (!disabled) {
series.nodes.each(function(node) {
if (node.dataItem.get("depth") == targetLevel && node !== targetNode) {
node.set("disabled", true);
}
})
}
})
Open in:New tabChart Maker
Limit to single open branch in ForceDirectedSerieslimit-to-single-open-branch-in-forcedirectedseries