cytoscape.js 中节点之间的填充

Padding between nodes in cytoscape.js

使用层次结构中的 cytoscape.js 创建了一个图表。我在节点的正确位置的每个节点附近放置了一些图表和标签,但它与层次结构中较近的节点重叠。有没有办法让节点之间space?

如果您想请求新功能或选项,您可以使用 layout options. If that is insufficient, then please file a feature request

layout 选项中使用 nodeSep 属性 例如:

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
        }});