a) Is there a way to have several textblocks on the center of a link but without a panel to put them together?
b) I’m playing around with segmentOrientation, is there a way to set a threshold for the rotation of the text? I mean, like do not rotate the text unless the perpendicular segment length is not at least y px
You can have a single label that consists of a Panel holding multiple TextBlocks (or anything else). Or you can have multiple labels, each of which is a TextBlock (or anything else). Whatever you want. This discusses how to arrange labels on a link: GoJS Link Labels -- Northwoods Software. It has some examples of multiple labels. I guess you have already read this.
No, the behavior of each of the enumerated segmentOrientation values is fixed. There is no easy way to extend or customize the behavior. Sorry. But you can probably implement your own code to set the segmentOrientation depending on the angle of the link.
I’m sorry, but I don’t understand what you want to do. Could you show a screenshot or sketch of what would happen when the link goes at 45 degrees or 90 degrees or 135 degrees?
Hi, something like this:
The idea would be to have T1 and T3 with segmentOrientation = Link.OrientUpright and T2 would be with Link.None (or OrientAlong?)
Well, it would be easiest to implement those as three separate labels. T1 and T3 would have segmentOrientation == go.Link.OrientAlong, and you wouldn’t bother setting segmentOrientation on T2, since None means it stays the way it is normally.
You’ll need to set segmentOffset to get the labels not to be centered on the link.
You’ll need to set segmentFraction on T1 and T3 to make them be a distance from the middle.
That’s not going to work because the naturalBounds, measuredBounds, and actualBounds aren’t computed until after the Link is routed and measured and arranged. Those properties certainly won’t be known when you are building the template.
If those strings really are constant, I suggest that you get the size from an instance in your diagram and then plug that number into your template.
If those strings will be of varying size, it would be best to do it much later, perhaps in an “InitialLayoutCompleted” DiagramEvent listener.