2015-09-24 42 views
1

我也试图在网格布局到定位节点的单元如下在网格布局中的特定细胞

layout: { name: 'grid', 
    fit: true, // whether to fit the viewport to the graph 
    rows:5, 
    columns:12, 
    padding: 10, // the padding on fit 
    position: function(node) 
    { console.log("Row : "+node.data('row') + ", COL : "+node.data('col')); 
     return {row:3, col:node.data('col')}; 
    } 
}, 

但节点总是在画布中间创建poistioning节点,即使我如上所述对行进行硬编码。任何建议,发生了什么。
谢谢

回答

0

如果您手动指定位置,则不需要设置整体尺寸。也许你已经过度约束它(例如排成行)?

或者,您可以设置尺寸和排序功能来指示排序。

+0

我没有得到你的整体尺寸是什么意思。以下是我也试过: 布局:{ \t名称: '网格', \t适合:真实, \t填充:5, \t位置:功能(节点){ \t \t \t \t \t的console.log( “Row:”+ node.data('row')+“,COL:”+ node.data('col')); \t \t \t \t \t return {row:2,col:3}; \t \t \t \t} \t} 没有运气 – msita143

+0

我的要求就是要改变布局我添加节点。所以如果我有一个节点,我希望它在第一行和第一列,如果我有两个应该在第三行和第一列。 第三个节点应该在第2行和第2列等我没有找到好的例子,要么 – msita143

+0

如果指定'position',没有'rows'和'columns'运行。你可以用动画重新运行网格,或者可乐可能更适合。你必须为你的用例做实验。 – maxkfranz