How to control the position of Linklabels


#1

How can I control the overlapping of Link Labels with any node, adornments and Links.
for example
this is how it looks

But if I change the position of the Node. It looks very bad

But what I actually want to achieve is this
JB_View_04%20%20%20Untitled%20%20%20Zeplin

so that even if I hover on the Node the Link Label will stay there and will not be overlapped by any of the GraphObjects

Here my code for creating a link

diagram.linkTemplate = GJS(go.Link, { selectable:false,
                                          routing: go.Link.Orthogonal, 
                                          curve: go.Link.JumpGap, 
                                          corner: 10 ,
                                          mouseHover:this.showDeleteButton},
      GJS(go.Shape, {fill: '#6f6f8d' , stroke: '#6f6f8d', strokeWidth: 2}),
      GJS(go.Shape, { toArrow: 'Triangle' , fill: '#6f6f8d' , stroke: '#6f6f8d'}),
      GJS(go.Panel, 'Auto', { width: 109, height: itemHeight, segmentIndex: 1, segmentFraction: 0.5,
        segmentOrientation: go.Link.OrientAlong ,segmentOffset: new go.Point(0, 0),
        },        
        GJS(go.Shape, 'RoundedRectangle', { fill: 'white'}),
        GJS(go.TextBlock, new go.Binding('text'))
      ),
      GJS(go.Panel,'Vertical',
      GJS(go.Picture,{source:'assets/icons/node_icons/link_data/wait.svg',segmentIndex: 2, segmentFraction: 0.5})),
    );

#2

Your description is confusing. My guess is that you want to set your link label segmentOffset: new go.Point(0, -20), or perhaps to a different offset.


#3

Sorry for confusing. Yes you are right I should change the offset of the LinkLabel. But I want the Link Label offset to be changed dynamically. (for eg. It should be (0,0) every time but if incase the link is shorter in length then the Link Label should change its offset dynamically.) please refer above images for example.


#4

It is not possible to specify that behavior by setting some properties. I think you would need to define a custom PanelLayout for Links.

Perhaps it would be easier to prevent the link from coming out the right side? fromSpot: go.Spot.NotRightSide ?


#5

Yes preventing the link from right side is good option. Thank you so much!