user1781328
user1781328

Reputation: 48

Cytoscape disappearing edges with bezier curves and nodes moving/longer labels in nodes

I am using cytoscape with bezier curves but edges are disappearing when having a node with longer label or just moving source node next to target node.

I have already seen "Edge xxxxx has invalid endpoints and so it is impossible to draw" warning and searched corresponding threads but couldn't find a solution.

Does anyone know how to handle that ?

Upvotes: 0

Views: 570

Answers (1)

canbax
canbax

Reputation: 3856

I see some warnings on the console

The style value of label is deprecated for width

The style value of label is deprecated for height

After I deleted 'width': 'label', 'height':'label', I no longer observe such problem.

--- Update 1.1 ---

but I'd like to have node's dimensions based on label's dimensions.

To do this I think you should write a function style. See the below example. In the example, you can see that we are setting the size of the nodes dynamically based on their name length. I assumed name is a string that stores labels.

cy.style().selector('node').style({
      'width': (x) => { return x.data('name').length + 'px;' }
      'height': (x) => { return x.data('name').length + 'px;' }
    }).update();

Upvotes: 1

Related Questions