在Cytoscape中,我想构建一个同心布局的图形,但不是一个完整的圆形,更像是半圆形或四分之一圆形,图形中心有一个元素,外侧有所有其他元素。“ p>
有没有办法从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; }
});
答案 0 :(得分:0)
文档中没有提及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)
因此,您可以像尝试一样指定开始和增量而不是开头和结尾。
E.g。 cy.layout({ name: 'concentric', startAngle: 0, sweep: Math.PI/2 }).run();