I am trying to create a SimpleLabelStyle
with the word wrapping
enabled, as the second box of the interactive demo. However, I am not able to reproduce it.
I am trying:
var /**yfiles.drawing.SimpleLabelStyle*/ simpleLabelStyle = new yfiles.drawing.SimpleLabelStyle();
simpleLabelStyle.trimming = yfiles.system.StringTrimming.WORD;
But it's not working. In fact, in the documentation, I see that trimming "gets the value that determines how to trim the text." (it just says "gets" and not "sets").
Any help is appreciated!
Definition of word wrap : a word processing feature that automatically transfers a word for which there is insufficient space from the end of one line of text to the beginning of the next.
uncountable noun. In computing, word wrapping is a process by which a word which comes at the end of a line is automatically moved onto a new line in order to keep the text within the margins.
Actually you can set the value - this documentation is misleading here. The property is declared READ-ONLY
in the interface (see the badge):
ISimpleLabelStyle.trimming API
But the instance that you have instanciated implements the interface and makes the property READ-WRITE
. Unfortunately the documentation is inherited from the interface and the only indication that the property is READ-WRITE is that the READ-ONLY
badge is missing in the API browser. Any property that is not READ-ONLY
or WRITE-ONLY
is implicitly readable and writable so setting the value will work using the property on the instance (SimpleLabelStyle.trimming API)
Note that if you are changing the value for an existing style, the change will not immediately be visible. You should invalidate the graph's displays using the IGraph.invalidateDisplays() API
var style = new yfiles.drawing.SimpleLabelStyle()
style.trimming = yfiles.system.StringTrimming.ELLIPSIS_WORD;
graph.setLabelStyle(label, style);
// and later
style.trimming = yfiles.system.StringTrimming.ELLIPSIS_CHARACTER;
graph.invalidateDisplays();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With