【发布时间】:2020-06-03 16:27:54
【问题描述】:
我正在尝试配置我的 GoJS 图(使用 LayeredDiagraphLayout),以使显示链接标签的面板(在此示例中显示百分比)始终位于前景,在图上所有其他项目的前面。目前,它在面板前面显示了一些链接线(如图所示):
我的目标:
确保显示百分比的面板始终显示在其他所有内容的前面。
到目前为止我所做的尝试:
将链接带入前景层(建议here):
myDiagram.linkTemplate =
$$(go.Link,
{ routing: go.Link.AvoidsNodes, curve: go.Link.JumpGap, corner: 5, layerName:"Foreground" },
$$(go.Shape, { strokeWidth: 3, stroke: "#555" }),
$$(go.Panel, "Auto", // this whole Panel is a link label
$$(go.Shape, "RoundedRectangle", { fill: "lightgray", stroke: "gray" }),
$$(go.TextBlock, { margin: 3 },
new go.Binding("text", "ownership"))
)
);
将zOrder 直接分配给上面代码中看到的go.Panel、go.Shape 和go.TextBlock 项目,但是,都给出了这样的错误:Uncaught Error: Trying to set undefined property "zOrder" on object: Shape(RoundedRectangle)。根据documentation,Part 扩展Panel,所以我希望我能够将zOrder 分配给Panel,但它给出了这个错误,所以显然我的期望是错误的。
如何配置此图表,以使链接上的面板始终位于前台,因此始终在其他所有内容的前面可见?谢谢!
【问题讨论】:
标签: javascript gojs