【问题标题】:Cytoscape Concentric layout start and end anglesCytoscape 同心布局开始和结束角度
【发布时间】:2018-04-23 12:36:55
【问题描述】:

在 Cytoscape 中,我想构建一个具有同心布局的图形,但不是一个完整的圆,更像是一个半圆或四分之一圆,一个元素位于图形的中心,所有其他元素位于外侧。

有没有办法从http://js.cytoscape.org 替换现有的同心布局? 问题是,我显然不能使用 endAngle,而且我在网上也找不到任何关于它的信息。我搜索这样的东西:

layout = cy.elements().layout({

    name: 'concentric',
    fit: true,
    padding: 30, 
    startAngle: 3/2 * Math.PI, // where nodes start in radians
    endAngle: 5/2 * Math.PI,// this doesn't work
    sweep: undefined,     
    clockwise: true, 
    equidistant: false, 
    minNodeSpacing: 10, 
    boundingBox: undefined, 
    avoidOverlap: true, 
    nodeDimensionsIncludeLabels: false, 
    height: undefined, 
    width: undefined, 
    spacingFactor: undefined, 
    concentric: function (node) { return node.degree();},
    levelWidth: function (nodes) { return nodes.maxDegree() / 4;},
    animate: false, 
    animationDuration: 500, 
    animationEasing: undefined, 
    animateFilter: function (node, i) { return true; }, 
    ready: undefined, 
    stop: undefined, 
    transform: function (node, position) { return position; } 
});

【问题讨论】:

    标签: javascript html layout cytoscape.js


    【解决方案1】:

    文档中没有提到endAngle。仔细阅读文档并仅使用受支持的字段。

    来自文档:

    startAngle: 3 / 2 * Math.PI, // where nodes start in radians
    sweep: undefined, // how many radians should be between the first and last node (defaults to full circle)
    

    因此,您可以指定开始和增量,而不是像您尝试过的那样指定开始和结束。

    例如cy.layout({ name: 'concentric', startAngle: 0, sweep: Math.PI/2 }).run();

    【讨论】:

    • 谢谢,应该可以的!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-10-08
    • 2017-04-18
    • 2023-03-11
    • 1970-01-01
    • 2014-03-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多