【问题标题】:Padding between nodes in cytoscape.jscytoscape.js 中节点之间的填充
【发布时间】:2015-01-21 05:29:29
【问题描述】:

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

【问题讨论】:

标签: cytoscape.js


【解决方案1】:

您可以使用layout 选项。如果这还不够,如果您想请求新功能或选项,请file a feature request

【讨论】:

  • 我们可以在布局选项中使用行和列吗?
  • 谢谢@maxkfranz。使用的布局{ name: 'dagre', nodeSep: 50 }
【解决方案2】:

在您的 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
        }});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-14
    • 2018-03-28
    • 2019-09-28
    • 1970-01-01
    • 2016-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多