我目前正在使用gojs创建树形结构图

我在排列节点时遇到问题,文字与箭头重叠

建议/帮助深表感谢

myDiagram.nodeTemplate =
$(go.Node, "Auto", {
    movable: true
  },
  $(go.Panel, "Vertical",

    $(go.Panel, "Auto", {
        background: "white"
      }, {
        portId: ""
      },
      $(go.Shape, "Circle", {
          strokeWidth: 4,
          margin: go.Margin.parse("10 5 10 5"),
          height: 75,
          width: 75,
          cursor: "pointer"
        },
        new go.Binding("fill", "color"), new go.Binding("stroke", "strokeColor")
      ),

      $(go.Panel, "Vertical",
        $(go.Picture, {
          source: "https://msdnshared.blob.core.windows.net/media/2017/05/icon.png",
          background: "white",
          width: 25,
          height: 25
        })
      )
    ),

    $(go.Panel, "Auto",
      $(go.TextBlock, {
          margin: 5,
          font: '14px "Open Sans", sans-serif'
        },
        new go.Binding("text", "name"))
    )
  )

);


我的工作fiddle is available

最佳答案

删除任务:

{
  portId: ""
},


阅读位于https://gojs.net/latest/intro/ports.html#SinglePorts的讨论,不同之处在于,您不是要让面板将包含圆形Shape和Picture的面板作为端口,而是要使用默认行为,即将整个Node用作端口。

关于javascript - 文本在gojs树图中与箭头重叠,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51379766/

10-09 16:09