Limit max characters and show 3 dots along with tooltip


#1

I want to restrict the characters upto certain counts, lets say 30. If the Text is longer than that, then i want to add 3 dots … and also the full text should be visible in tooltip.

refer following screenshot.

How can i do that?


#2

That is described at https://gojs.net/latest/intro/textBlocks.html#MaxLinesAndOverflow and at https://gojs.net/latest/intro/toolTips.html, where you would constrain the text to a wider width.


#3

Thanks. I enabled maxline and tooltip.

I want to show tooltip only if the overflow has added 3 dots. How can i add this condition in tooltip ?

Is it possible that when i click on the node, it show me full name ?


#4

I’m not sure there’s an easy way to tell if the text has been truncated or if the ellipsis string is shown.

Instead of showing a tooltip, yes, you could have a click or other event reset the properties on the TextBlock so that it wasn’t limited to a certain number of lines or a certain height.