Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.


How to truncate edge label

0 votes
I have a number of edge labels that have multiple lines of text. I would like to be able to just display the first line. Right now, it would seem, I can either show everything or hide the label altogether.
in Help by (130 points)
recategorized by

1 Answer

+1 vote
  1. Create a custom text property for edges ("Edit" -> "Manage Custom Properties") that stores the complete text. See Properties of Graph Elements in the yEd Manual for additional information.
  2. Create a property mapping ("Edit" -> "Properties Mapper") that transforms your custom text property into edge label text. (See Mapping Custom Properties to Visual Properties in the yEd Manual for additional information.)
    To extract only the first line from your text property, use "Regular Expression" as "Conversion" type with "Pattern" value "(?s)(.*?)\n.*" and "Replacement" value "$1" (both without the quotes):

    (This assumes plain text, extracting the first line from HTML formatted text is much more complicated.)
by [yWorks] (138k points)
edited by
Legal Disclosure | Privacy Policy