【问题标题】:Edge bundling for Cose-Bilkent in Cytoscape.jsCytoscape.js 中 Cose-Bilkent 的边缘捆绑
【发布时间】:2018-09-20 20:06:30
【问题描述】:

我正在使用 Cose-Bilkent 布局来显示嵌套图,但是当边太多时它会变得有点混乱。为了以视觉方式改进图表,我正在考虑对图表使用一些边缘捆绑。我一直在做一些研究,似乎我应该能够通过设置控制点步长和/或控制点重量之类的东西来做到这一点,但我仍然不清楚如何做到这一点诚实的。我的想法是根据某个父节点的位置设置该控制点。下面我附上一张截图,上面有我想要得到的草图(抱歉草图不好)。有人可以指导我如何获取该父控制点,然后设置是否为边缘? enter image description here谢谢!

【问题讨论】:

    标签: cytoscape.js


    【解决方案1】:

    我认为您只需将控制点属性添加到您的样式中 :) 您可以使用bezier edge-styleunbundled bezier edge-style

    var cy = cytoscape({
    
      container: yourContainer, // container to render in
    
      elements: yourElements,
    
      style: [ // the stylesheet for the graph
        {
          selector: 'node',
          style: {
            'background-color': yourColor,
            'label': yourLabel
          }
        },
    
        {
          selector: 'edge',
          style: {
            'width': 3,
            'line-color': '#ccc',
            'target-arrow-color': '#ccc',
            'target-arrow-shape': 'triangle'
            'curve-style': 'bezier',
            // 'curve-style': 'unbundled-bezier', // this is a manual bezier, maybe try out this one too
            'control-point-things': xyz
          }
        }
      ],
    
      layout: {
        name: yourLayout
      }
    
    });
    

    【讨论】:

    • 感谢 Stephan T. 的回复。我实际上已经尝试过curve-style 类型和unbundled bezier 类型,它不处理自循环(我的数据中有很多),所以我可能会坚持使用bezier。我的主要疑问是如何为复合节点指定那些control-point-things。我是否需要指定控制点上涉及的所有参数,例如control-point-step-sizecontrol-point-distancecontrol-point-weight?这将有助于一些关于如何指定这些参数的简单示例......
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-26
    • 2015-08-19
    • 1970-01-01
    • 2016-10-17
    • 1970-01-01
    相关资源
    最近更新 更多