Skip to content

Disabling hierarchical layout and re-enabling it causes errors #178

@Tyler-Maclachlan

Description

@Tyler-Maclachlan

Hi there,

I am using the hierarchical layout with edges that can be 'split?', when splitting the edges I disable the layout so that none of the nodes move (it's really frustrating having the node you were looking at suddenly move), however when I re-enable the layout afterwards I get the following error:

Uncaught Error: To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.

I have predefined levels manually on every node, and looping through the DataSet shows that each node does indeed have a level.

Here's how I do it:

this.options.layout.hierarchical.enabled = false;
this.network.setOptions(this.options);

// split the edges

// loop over the data set and log the node level - every node has a level
this.graphNodes.forEach(n => {
     console.log(n.level);
})
this.options.layout.hierarchical.enabled = true;
this.network.setOptions(this.options);

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions