Fault trees are used to conduct deductive failure analysis in which an undesired state of a system is analyzed using Boolean logic to combine a series of lower-level events.

This diagram uses a basic TreeModel and TreeLayout to layout nodes in a tree structure. The Diagram.nodeTemplate definition allows for text describing the undesirable states and, when necessary, a figure indicating an event/gate.

The visible property on some of the node template's Shapes is set based on whether a figure is chosen for the node in the Model.nodeDataArray. The nodes also display a TreeExpanderButton allowing for expanding/collapsing of subtrees. See the Intro page on Buttons for more GoJS button information.

Related to deductive failure analysis is root cause analysis, or RCA. See the fishbone layout extension page for a diagram format typically used in root cause analysis.

Diagram Model saved in JSON format:
{ "class": "go.TreeModel", "nodeDataArray": [ {"key":1, "text":"No flow to receiver", "figure":"None"}, {"key":2, "text":"No flow from Component B", "parent":1, "figure":"OrGate", "choice":"G02"}, {"key":3, "text":"No flow into Component B", "parent":2, "figure":"AndGate", "choice":"G03"}, {"key":4, "text":"Component B blocks flow", "parent":2, "figure":"Circle", "choice":"B01"}, {"key":5, "text":"No flow from Component A1", "parent":3, "figure":"OrGate", "choice":"G04"}, {"key":6, "text":"No flow from Component A2", "parent":3, "figure":"OrGate", "choice":"G05"}, {"key":7, "text":"No flow from source1", "parent":5, "figure":"Triangle", "choice":"T01"}, {"key":8, "text":"Component A1 blocks flow", "parent":5, "figure":"Circle", "fill":"green", "choice":"B02"}, {"key":9, "text":"No flow from source2", "parent":6, "figure":"Triangle", "choice":"T02"}, {"key":10, "text":"Component A2 blocks flow", "parent":6, "figure":"Circle", "choice":"B03"} ]}

### GoJS Features in this sample

#### Tree Layout

This predefined layout is used for placing Nodes of a tree-structured graph in layers (rows or columns). For discussion and examples of the most commonly used properties of the TreeLayout, see the Trees page in the Introduction. More information can be found in the GoJS Intro.

Related samples

#### Buttons

GoJS defines several Panels for common uses. These include "Button", "TreeExpanderButton", "SubGraphExpanderButton", "PanelExpanderButton", "ContextMenuButton", and "CheckBoxButton". "ContextMenuButton"s are typically used inside of "ContextMenu" Panels; "CheckBoxButton"s are used in the implementation of "CheckBox" Panels.

These predefined panels can be used as if they were Panel-derived classes in calls to GraphObject.make. They are implemented as simple visual trees of GraphObjects in Panels, with pre-set properties and event handlers.

More information can be found in the GoJS Intro.

Related samples