Textblock line count

hello i’m new in go js, how can i find out the number of lines in a block of text. Another question, how do I access a property of an object such as (shape, node, text block …)
Thanks in advance

Use the TextBlock.lineCount property.

Could you please be more specific about your other question?
Does this help? GraphObject Manipulation

Anmerkung 2020-08-18 123639
Anmerkung 2020-08-18 123612

I have four text blocks on a shape title and description and head and deputy but the problem is that the description can have more than three lines and should be displayed more line when enlarged and at the same time all text blocks are displayed in the middle of the shape without overlapping.

I change the alignment after changing the height of the shape, sometimes it does not work
is the syntax ( new binding ) for aligment right ?

new go.Binding(“alignment”, “”, function(v) {
var shapeHeightInt = parseInt(v.shapeHeight);
// var lineCountObj = obj.lineCount;
console.log("ShapeHeightInt "+ shapeHeightInt);
console.log("gridSize " +gridSize);
// console.log("lineCount " +lineCountObj);
return graphMode == GRAPH.ORGCHART.value ? go.Spot(0, 0, 3, shapeHeightInt *1 - 70) : null
}).makeTwoWay()

How is your node template organized?
It probably should be like:

Node, "Auto"
    Shape  // the border
    Panel, "Vertical"
        TextBlock
        TextBlock
        TextBlock
        TextBlock

Maybe you need more in it than that – I’m just guessing.
There should be no need for a Binding on alignment for the reasons that I suspect that you are thinking.

Please read:
https://gojs.net/latest/intro/panels.html
https://gojs.net/latest/intro/nodes.html

Ok thank you very much i will try.
is the syntax ( new binding ) for aligment right ?

You should not be using such a Binding anyway.

But if you did, the source property name shouldn’t be an empty string and you probably would not want it to be a TwoWay Binding.