Radhika
Radhika

Reputation: 41

Padding between nodes in cytoscape.js

Created a graph using cytoscape.js in hierarchical structure. I am placing some charts and labels near each node at right position of the node but it is overlapping the nearer node in hierarchical structure. Is there any way to make space between nodes?

enter image description here

Upvotes: 2

Views: 4689

Answers (2)

Kunal Ganglani
Kunal Ganglani

Reputation: 81

Use nodeSep property in your layout options For example:

var cy = window.cy = cytoscape({
        container: document.getElementById('cy'),

        layout: {
          stop: function () {
            cy.automove({
              nodesMatching: cy.$(':parent *'),
              reposition: 'drag',
              dragWith: cy.$(':parent *')
            });
          },
          name: 'cose-bilkent',
          animate: 'end',
          nodeSep: 20, // >>>>>>YOUR TARGET PROPERTY<<<<<<<
          animationEasing: 'ease-out',
          animationDuration: 2000
        }});

Upvotes: 1

maxkfranz
maxkfranz

Reputation: 12242

You can play with the layout options. If that is insufficient, then please file a feature request if you want to request new features or options.

Upvotes: 1

Related Questions