Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/395.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中向端口添加编号?_Javascript_Gojs - Fatal编程技术网

Javascript 如何在GoJS中向端口添加编号?

Javascript 如何在GoJS中向端口添加编号?,javascript,gojs,Javascript,Gojs,您好,我需要为每个端口添加编号,如下图所示。 注:我曾如何在本网站上寻找解决问题的方法,并使用portId和TextBlock检查解决方案,但不起作用:/ 您正在使用一个形状作为端口,但任何GoJS对象都可以是端口,并且您确实希望使用一个带有形状和文本块的面板(自动面板)作为端口 我建议您阅读:您正在使用一个形状作为端口,但是任何GoJS对象都可以是端口,并且您确实希望使用一个带有形状和文本块的面板(自动面板)作为端口 我建议你读一读:嗨,谢谢你的回答:)嗯,我试着用一个面板,但我看不到变化:/

您好,我需要为每个端口添加编号,如下图所示。 注:我曾如何在本网站上寻找解决问题的方法,并使用
portId
TextBlock
检查解决方案,但不起作用:/


您正在使用一个形状作为端口,但任何GoJS对象都可以是端口,并且您确实希望使用一个带有形状和文本块的面板(自动面板)作为端口


我建议您阅读:

您正在使用一个形状作为端口,但是任何GoJS对象都可以是端口,并且您确实希望使用一个带有形状和文本块的面板(自动面板)作为端口


我建议你读一读:

嗨,谢谢你的回答:)嗯,我试着用一个面板,但我看不到变化:/我做错了什么

this.$(go.Panel, 'Horizontal',
  new go.Binding('itemArray', 'bottomArray'),
  {
    row: 2, column: 1,
    itemTemplate:
      this.$(go.Panel, 'Vertical',
        {
          _side: 'bottom',
          fromSpot: go.Spot.Bottom, toSpot: go.Spot.Bottom, fromMaxLinks: 1,
          fromLinkable: true, toLinkable: false, cursor: 'pointer'
        },
        new go.Binding('portId', 'portId'),

        this.$(go.Shape, 'RoundedRectangle',
          {
            stroke: null, strokeWidth: 0,
            desiredSize: portSize,
            margin: new go.Margin(2, 1, 0, 1)
          },
          new go.Binding('fill', 'portColor')),
        this.$(go.TextBlock,
          new go.Binding('text', 'name'))
      )
  }
),

嗨,谢谢你的回答:)嗯,我试着用一个面板,但我看不到变化:/我做错了什么

this.$(go.Panel, 'Horizontal',
  new go.Binding('itemArray', 'bottomArray'),
  {
    row: 2, column: 1,
    itemTemplate:
      this.$(go.Panel, 'Vertical',
        {
          _side: 'bottom',
          fromSpot: go.Spot.Bottom, toSpot: go.Spot.Bottom, fromMaxLinks: 1,
          fromLinkable: true, toLinkable: false, cursor: 'pointer'
        },
        new go.Binding('portId', 'portId'),

        this.$(go.Shape, 'RoundedRectangle',
          {
            stroke: null, strokeWidth: 0,
            desiredSize: portSize,
            margin: new go.Margin(2, 1, 0, 1)
          },
          new go.Binding('fill', 'portColor')),
        this.$(go.TextBlock,
          new go.Binding('text', 'name'))
      )
  }
),