Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/438.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用GoJS更改链接上面板的zOrder_Javascript_Gojs - Fatal编程技术网

Javascript 使用GoJS更改链接上面板的zOrder

Javascript 使用GoJS更改链接上面板的zOrder,javascript,gojs,Javascript,Gojs,我试图配置我的GoJS图(使用LayeredDiagraphLayout),以便显示链接标签的面板(在本例中显示百分比)始终位于前台,位于图上所有其他项目的前面。当前,它在面板前面显示一些链接线(如图所示): 我的目标: 确保显示百分比的面板始终在所有其他对象前面可见 到目前为止我所尝试的: 将链接带到前景层(如建议的): 但是,将a直接分配给上面代码中看到的go.Panel、go.Shape和go.TextBlock项都会产生如下错误:未捕获错误:尝试在对象:Shape(roundedlec

我试图配置我的GoJS图(使用LayeredDiagraphLayout),以便显示链接标签的面板(在本例中显示百分比)始终位于前台,位于图上所有其他项目的前面。当前,它在面板前面显示一些链接线(如图所示):

我的目标:

确保显示百分比的面板始终在所有其他对象前面可见

到目前为止我所尝试的:

将链接带到前景层(如建议的):

但是,将a直接分配给上面代码中看到的
go.Panel
go.Shape
go.TextBlock
项都会产生如下错误:
未捕获错误:尝试在对象:Shape(roundedlectangle)
上设置未定义的属性“zOrder”。根据,
部分
扩展了
面板
,因此我希望能够将
zOrder
分配给
面板
,但它给出了这个错误,因此显然我的期望是错误的

如何配置此图,使链接上的面板始终位于前台,因此在所有其他对象之前始终可见?谢谢大家!

有关讨论,请参阅

假设标签是链接的第二个元素,可能这就是您想要的:

      $(go.Diagram, . . .,
        {
          layout: $(go.LayeredDigraphLayout, { direction: 90, . . . }),
          "LayoutCompleted": function(e) {
            e.diagram.links.each(function(l) { l.elt(1).segmentIndex = -Infinity; });
            e.diagram.nodes.each(function(n) {
              var outs = n.findLinksOutOf();
              var ins = n.findLinksInto();
              if (outs.count === 1) outs.first().elt(1).segmentIndex = 1;
              else if (ins.count === 1) ins.first().elt(1).segmentIndex = -2;
            });
          },
          . . .

谢谢你的回复,沃尔特,这就是在你的论坛上问这个问题的那个人。到目前为止,你帮了我很大的忙,我将尝试你的最新建议,并会跟进!
      $(go.Diagram, . . .,
        {
          layout: $(go.LayeredDigraphLayout, { direction: 90, . . . }),
          "LayoutCompleted": function(e) {
            e.diagram.links.each(function(l) { l.elt(1).segmentIndex = -Infinity; });
            e.diagram.nodes.each(function(n) {
              var outs = n.findLinksOutOf();
              var ins = n.findLinksInto();
              if (outs.count === 1) outs.first().elt(1).segmentIndex = 1;
              else if (ins.count === 1) ins.first().elt(1).segmentIndex = -2;
            });
          },
          . . .