gpt4 book ai didi

javascript - mxgraph 中的自动泳道布局

转载 作者:行者123 更新时间:2023-12-01 14:45:54 26 4
gpt4 key购买 nike

有泳道example在 mxgraph 中,但它不是自动的。所以我拿了graphlayout以示例为基础,并进行了一些更改:

  • 始终使用 mxSwimlaneLayout
  • 从泳道示例中获取泳道单元样式
  • 创建了两条泳道
  • 将它们用作顶点的父节点

  • 以下是我创建泳道的方法:
    var lane1 = graph.insertVertex(parent, null, 'Lane 1', 0, 0, 1000, 100, 'swimlane');
    var lane2 = graph.insertVertex(parent, null, 'Lane 2', 0, 100, 1000, 100, 'swimlane');
    // use as parent...
    var v1 = graph.insertVertex(lane1, null, 'A', 0, 0, w, h);

    并执行布局:
    layout.orientation = mxConstants.DIRECTION_WEST;
    layout.resizeParent = true;
    layout.execute(parent, [lane1, lane2]);

    这是 test page .

    现在,这里有两个问题:
  • 节点未放置在 channel 内;似乎根本不尊重车道。如何进行布局以将节点放置在适当的 channel 内?像 parent 一样划清界限似乎是不够的。
  • 我以为 WES​​T 会在左边建立图表,但事实恰恰相反...... NORTH 也会下降......为什么?
  • 最佳答案

    远非完美,但不知何故有所改进:
    Demo
    我已经添加:

    layout.execute(lane1, [v1,v2,v3,v4]);
    layout.execute(lane2, [v5,v6,v7,v8]);
    并更改了 resizeParentfalse ,看起来车道受到尊重,但看起来仍然不愉快。
    enter image description here

    关于javascript - mxgraph 中的自动泳道布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44330233/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com