Subtrees program problem's with GoJs

Hello,please I need your help to find the mistake in this code, because il doesn’t work at all.
I want to have like this tree in the picture below.
This is my code :

I don’t see any code in which we could possibly find any errors.

Sorry,I edited the post,the code is in the two pictures.Thank u for your help!

Posting code in images rather than as text makes it hard to read and impossible to try or modify or comment.

What is the precise nature of your problem? What is happening and what do you want to keep the same and what do you want to be different? Screenshots of diagrams, before and after, help a lot.

You don’t have a consistent diagram throughout your program. You’re referencing something by Diagram, diagram, and myDiagram in different places, and you never initialized it. You also don’t seem to have an actual HTML div to hold the diagram. Look at some of the samples to see how we typically do it.

In general, we can’t do basic debugging of your code.

I put the code in this file to make it easy to correct the errors.My purpose is to have the diagram in the picture .I took the functions from GoJS library website.
My code:

It’s better to post your code here, formatted nicely.

What’s the value of “diagram”? Where is it initialized?

Have you stepped through your code in the debugger and found the cause of the errors that you are getting?