首页 > 解决方案 > 文本与 gojs 树图中的箭头重叠

问题描述

我目前正在使用 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"))
    )
  )

);

我的工作小提琴可用

标签: javascripthtmlgojs

解决方案


删除分配:

{
  portId: ""
},

阅读讨论:https ://gojs.net/latest/intro/ports.html#SinglePorts ,除了让面板保持圆形形状图片作为端口,您希望整个节点行为的默认行为作为港口。


推荐阅读