How should I create a Tree diargram with links

Hi how can I build diagram with link ( picture attach…)

how can i use it???

Is that a single link with an “OR” label, or is “OR” a node and there are two links drawn in red connecting the two “Method…” nodes?

In either case, if you are using TreeLayout, you will want those one or two links to have Link.isTreeLink and Link.isLayoutPositioned set or bound to false.

BTW, an easy way of obscuring text in photos is to temporarily set TextBlock.stroke to null or to set TextBlock.background to your stroke color.

Im using TREEMODEL and need to use links to … how can i do it?

??? Please explain what you need to do.

I have diagram that need to be a tree model and inside the tree I need to use graph .

Now I can show only the tree (like the first picture) not the second part that i paint in red…

OK, could you please show us the model?

var $ = go.GraphObject.make; // for conciseness in defining templates

var myDiagram = $(go.Diagram, {

"toolManager.mouseWheelBehavior": go.ToolManager.WheelZoom,

initialDocumentSpot: go.Spot.Top,

initialViewportSpot: go.Spot.Top,

"undoManager.isEnabled": true,

layout: $(go.TreeLayout, {

  angle: 90,

  alternateAlignment: go.TreeLayout.AlignmentBus,

  nodeSpacing: 50,


model: $(go.GraphLinksModel, {

  linkKeyProperty: "key", // IMPORTANT! must be defined for merges and data sync when using GraphLinksModel



// create the Model with data for the tree, and assign to the Diagram
myDiagram.model = $(go.TreeModel);
return myDiagram;

Thanks for telling us about how you set up the Diagram, but I was asking about what data is in your model.

My data looks like this…
nodeData = [{ key: “ABC” , Desc: “My Description” , { key: “DEF”, Desc: “My Second Description”, parent: “ABC”}, {key:“oper”, desc: “XOR”, from: “ABC” , to : "DEF} ]

add the data his look like key + desc + parent I want to connect like a tree and from to like a graph.
this is make the things clear?

If you want non-tree-like graphs, you cannot use TreeModel, but must use GraphLinksModel.

Thanks for your help!

But how can I define to build vertical nodes and horizonal node with the same diagram?
Somehow you need to specify whether a node should be in the same layer as another node. If you are using a TreeModel, you don’t have much flexibility.

That sample makes the assumption that the horizontal links do not need to be in the model, so using a TreeModel is still possible. But using a GraphLinksModel is far more general and flexible. In either case you need to customize theTreeLayout.

Can i get the code of this code?!?!?!

As with almost all of our samples, all of the code is right there in the page – just view the source of the page.