简体   繁体   English

如何使用可乐在 cytoscape.js 中设置边缘的长度?

[英]How to set the edge's length in cytoscape.js with cola?

I am using the latest version of cytoscape.js and cola.js.我正在使用最新版本的 cytoscape.js 和 cola.js。 When I change "edgelength" nothing happens.当我更改“edgelength”时,什么也没有发生。

how can I do this?我怎样才能做到这一点?

You can specify one of edgeLength , edgeSymDiffLength , or edgeJaccardLength in the layout options.您可以在布局选项中指定edgeLengthedgeSymDiffLengthedgeJaccardLength之一。

From the docs :文档

// different methods of specifying edge length
// each can be a constant numerical value or a function like `function( edge ){ return 2; }`
edgeLength: undefined, // sets edge length directly in simulation
edgeSymDiffLength: undefined, // symmetric diff edge length in simulation
edgeJaccardLength: undefined, // jaccard edge length in simulation

As this is a force-directed layout and you can set multiple constraints, you may not get the effect you're looking for if you overconstrain the system -- which is easy to do.由于这是一个力导向的布局,您可以设置多个约束,如果过度约束系统,您可能无法获得所需的效果——这很容易做到。 Consider that constraints on some edge lengths may contradict constraints on other edge lengths.考虑对某些边长的约束可能与对其他边长的约束相矛盾。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM