Hi everyone,
I’m currently working on a GoJS diagram where I need nodes to dynamically resize based on the length of the text inside them. The goal is to ensure that the text is always fully visible without being clipped or wrapped unnecessarily.
What I Have Tried:
- Using
TextBlock.wrap
andTextBlock.overflow
properties – This works to some extent, but the node size doesn’t always adjust correctly. - Setting
TextBlock.width
toNaN
– This allows some flexibility, but it doesn’t fully resize the surrounding node shape. - Binding the
width
of theTextBlock
to itsmeasuredSize.width
– However, I noticed inconsistencies when dynamically updating text content.
What I Need Help With:
- Is there a best practice for dynamically adjusting node size based on text content?
- Should I be using Panel.Auto or another layout approach to ensure the node resizes properly?
- How can I ensure that when text updates, the node resizes smoothly without visual glitches?
If anyone has encountered a similar issue and found a reliable solution, I’d love to hear your insights! Code snippets or examples would be greatly appreciated.
I also checked this: https://forum.nwoods.com/t/add-links-dynamically-like-diagram-model-addnodedata-for-nodes/python
Thanks in advance!