How to achieve this effect

Hello, I just contacted gojs, I would like to ask how I can achieve this effect in the figure, the number in the red circle can be expanded by clicking, if the current state is expanded, click again to collapse the node, thank you

If I understand you correctly, you could either data bind your node’s appearance based on the Node.isTreeExpanded property, or use two different node templates – one for the normal case as you have now, and one for when the node is collapsed. Then you could just bind:

    new go.Binding("category", "isTreeExpanded", x => x ? "" : "Collapsed").ofObject()

on both your node templates.

Hello, I want to ask another question, how can I move this TreeExpanderButton to the intersection of two lines