Archi Forum

Archi => General Archi Discussion => Topic started by: Xiaoqi on July 16, 2022, 19:12:47 PM

Title: How to set auto-wrap of "Documentation" as Label in View?
Post by: Xiaoqi on July 16, 2022, 19:12:47 PM
Hello,

See attached first view, I'm making a model (sorry in Chinese characters but language is not relevant I hope) and want to show the "Documentation" of the Relation using Label.

Some Documentations contain quite long description, however, by default, it is displayed in Single Line, which you can see the left and right Label texts are overlapping each other.

I found below old discussion as well as the feature request in Github, below, but looks like it was talking on the Name+Label display in the component, which is slightly different, so I open this new question here.

https://forum.archimatetool.com/index.php?topic=511.0 (https://forum.archimatetool.com/index.php?topic=511.0)

I tried to use "<br>" or "\n" in the Documnentation, but it's not treated as JS or HTML code so they're no effect.

The 2nd view was actually used the Hard-Enter with manually judge on the width of each line, it is OK for showing in this specific view, while I don't like such kind of "hard coding" as it would be not suitable when use that in other view with wider or narrower space.

Thus, I'd like to learn from you, is there any possible to configure the Word-Wrap behavior (maybe as one global parameter for displaying or OK as specific setting) that we can set like "wrap at 40th characters per line"? Or some alternative that we can set to prevent Single Line?

Hope I explain this clearly. I've now using Archi 4.10 beta, but again I don't think version is making difference.

Thanks a lot, regards,
Xiaoqi
Title: Re: How to set auto-wrap of "Documentation" as Label in View?
Post by: Phil Beauvoir on July 16, 2022, 19:26:53 PM
Hi,

you could use the "wordrap" expression in the label expression. For example:

${wordwrap:12:${documentation}}
See https://github.com/archimatetool/archi/wiki/Label-Expressions

Regards,

Phil
Title: Re: How to set auto-wrap of "Documentation" as Label in View?
Post by: Xiaoqi on July 16, 2022, 22:41:12 PM
Hi Phil,

Thanks for information, need more learning of those Label Expressions, quite useful!

However, tried this specific one, but it's now working on my model, neither label on component or on relation. Could you please see attached test model view? Anything wrong on my using this expression?

Thanks again,
Xiaoqi
Title: Re: How to set auto-wrap of "Documentation" as Label in View?
Post by: Xiaoqi on July 17, 2022, 00:14:23 AM
Hi Phil again,

I did some more testing and found the result is interesting, as attached pictures.

In Picture 1:
- Name is "Application Function1", which has 21 characters
- Documentation is lots of "b", without space

Then the results are:
1. ${name}: "Application Function1" as single line, correct
2. ${wordwrap:0:${name}} to @{wordwrap:20:${name}}: as long as the total # of chars are bigger than the 'count', it is wrapped to two lines, while not see wrap per count of chars
3. when 'count' reach 21 and more, ${wordwrap:21:${name}}: back to display as single line
4. For Documentation, no matter how much of 'count' set, the word wrap is not happen.

Then, the Picture 2 I input the Documentation with many spaces, as "a b c d e f g h i j k l m n", the result shows the correct 'count' wrapping, when count=6 and count=12, the result is as expected.

Thus, I'd like to learn more backend logic, looks like the "wordwrapping" is depending on whether there're Spaces within the Documentation.

Back to the pictures in the top question, when I use Chinese sentences into the text (e.g. Documentation), the Chinese language normally has no Space between the characters, thus why I cannot see word-wrapping no matter the number of 'count' I set.

Hope to get clarification, thanks,
Xiaoqi
Title: Re: How to set auto-wrap of "Documentation" as Label in View?
Post by: Xiaoqi on July 17, 2022, 03:24:54 AM
Quote from: xiaoqi on July 16, 2022, 22:41:12 PMHi Phil,

Thanks for information, need more learning of those Label Expressions, quite useful!

However, ... but it's now working on my model, neither label on component or on relation. Could you please see attached test model view? Anything wrong on my using this expression?

Thanks again,
Xiaoqi

Sorry should be NOT working, my typo error
Title: Re: How to set auto-wrap of "Documentation" as Label in View?
Post by: Phil Beauvoir on July 17, 2022, 08:48:47 AM
Hi Xiaoqi,

yes the wordwrap uses spaces in the text.

Don't know what would be best for your use case, we didn't consider Chinese characters when we implemented it.

Regards,

Phil
Title: Re: How to set auto-wrap of "Documentation" as Label in View?
Post by: Xiaoqi on July 23, 2022, 01:03:10 AM
Thanks Phil, now understand the logic.

And yes, the "word" and "phrase" expression in Chinese language is different to English, e.g. it's not seperating words by space, I'll think about that to find workaround first.

Regards,
Xiaoqi