1

I want to have "loc" value (positioning value eg. loc = "10 10") automatically calculated for statechart according to number of nodes in GOJS. Is there any specific attributes or commands to do it ?

4

2 回答 2

2

GoJS 具有用于自动节点和链接定位的布局的概念。

可以创建自己的布局,根据自定义标准定位节点。这里有一个关于制作你自己的布局的介绍扩展库中的示例。

于 2015-09-09T17:17:31.930 回答
2

Diagram.layout 设置为 ForceDirectedLayout一个实例。

所以只需将这一行添加到 StateChart.html 中的 Diagram 的初始化中:

layout: $(go.ForceDirectedLayout),

根据您希望何时发生布局,您可能有兴趣将Layout.isInitial设置为 false 和/或将Layout.isOngoing设置为 false。在“布局简介”页面上阅读更多内容。

于 2015-09-09T17:26:05.787 回答