Joel Gordon
Joel Gordon

Reputation: 11

Reducing unused space/arrow length for cytoscape js layouts

I am using the cytoscape js library for displaying a hierarchy of images. I followed the example on http://jsbin.com/gist/aedff159b0df05ccfaa5?js,output and found that the breadthfirst layout is what I need.

However, I find the rendered result unsatisfactory due to too much unused space. The arrows are too long. Even the example (http://jsbin.com/gist/aedff159b0df05ccfaa5?js,output) has this issue. For this example, I tried the following

  1. Increase the "height/width" in .selector('node') .css({
  2. Muck around with the distanceX and distanceY (node spacing) variables in layout.breadthfirst.js (line 352).

I am unable to reduce the unused space or reduce the length of the arrows.

Upvotes: 0

Views: 624

Answers (2)

Djames
Djames

Reputation: 502

For rushing Devs, try this layout option:

spacingFactor: 0

The manual says :

spacingFactor: 1.75, // positive spacing factor, 
                     // larger => more space between nodes (N.B. n/a if causes overlap)

That's the result of the ticket https://github.com/cytoscape/cytoscape.js/issues/737 reported by maxkfranz.

Upvotes: 1

maxkfranz
maxkfranz

Reputation: 12242

Ticket to follow: https://github.com/cytoscape/cytoscape.js/issues/737

If you want a new feature in future, please file a ticket.

Upvotes: 1

Related Questions