Graph Maker
WMG_Hierarchical_Tree Class Reference

A class used for creating hierarchical tree type graphs. More...

Inheritance diagram for WMG_Hierarchical_Tree:
WMG_Graph_Manager WMG_Events WMG_GUI_Functions WMG_Text_Functions

Public Types

enum  ResizeProperties { ResizeProperties.NodeWidthHeight = 1 << 0, ResizeProperties.NodeRadius = 1 << 1 }
 
- Public Types inherited from WMG_Text_Functions
enum  WMGpivotTypes {
  WMGpivotTypes.Bottom, WMGpivotTypes.BottomLeft, WMGpivotTypes.BottomRight, WMGpivotTypes.Center,
  WMGpivotTypes.Left, WMGpivotTypes.Right, WMGpivotTypes.Top, WMGpivotTypes.TopLeft,
  WMGpivotTypes.TopRight
}
 

Public Member Functions

void Init ()
 Initializes this graph, and should be called before anything else. More...
 
void setOriginalPropertyValues ()
 Caches initial property values that are used as the basis for resizeEnabled functionality, called automatically during Init. More...
 
void Refresh ()
 Refreshes the graph, and happens automatically in Update(), but sometimes it is useful or necessary to call this manually, note that refresh updates only the parts of the graph affected by properties that have changed since a last refresh. More...
 
List< GameObject > getNodesInRow (int rowNum)
 Gets the nodes in the specified row. More...
 
List< GameObject > getNodesInColumn (int colNum)
 Gets the nodes in the specified column. More...
 
- Public Member Functions inherited from WMG_Graph_Manager
GameObject CreateNode (Object prefabNode, GameObject parent)
 Creates a node for this graph. More...
 
GameObject CreateLink (WMG_Node fromNode, GameObject toNode, Object prefabLink, GameObject parent)
 Creates a link for this graph, and repositions the link. More...
 
GameObject CreateLinkNoRepos (WMG_Node fromNode, GameObject toNode, Object prefabLink, GameObject parent)
 Creates a link for this graph, and does not repoisition the link. More...
 
WMG_Link GetLink (WMG_Node fromNode, WMG_Node toNode)
 Given two nodes, get the link between those nodes for this graph. More...
 
GameObject ReplaceNodeWithNewPrefab (WMG_Node theNode, Object prefabNode)
 Given a node, and a prefab, re-instantiate the node using the specified prefab which has a WMG_Node script attached. More...
 
void DeleteNode (WMG_Node theNode)
 Deletes a node. More...
 
void DeleteLink (WMG_Link theLink)
 Deletes a link. More...
 
List< WMG_LinkFindShortestPathBetweenNodes (WMG_Node fromNode, WMG_Node toNode)
 Given two nodes return one or more shortest paths between the nodes based on the number of links (unweighted), using Breadth-first search algorithm. More...
 
List< WMG_LinkFindShortestPathBetweenNodesWeighted (WMG_Node fromNode, WMG_Node toNode, bool includeRadii)
 Given two nodes return one or more shortest paths between the nodes based on the link weights (weighted), and also node radii if include radii is true, using Dijkstra's algorithm. More...
 
- Public Member Functions inherited from WMG_Events
delegate void WMG_Click_H (WMG_Series aSeries, WMG_Node aNode, PointerEventData pointerEventData)
 
void addNodeClickEvent (GameObject go)
 
delegate void WMG_Link_Click_H (WMG_Series aSeries, WMG_Link aLink, PointerEventData pointerEventData)
 
void addLinkClickEvent (GameObject go)
 
delegate void WMG_Click_Leg_H (WMG_Series aSeries, WMG_Node aNode, PointerEventData pointerEventData)
 
void addNodeClickEvent_Leg (GameObject go)
 
delegate void WMG_Link_Click_Leg_H (WMG_Series aSeries, WMG_Link aLink, PointerEventData pointerEventData)
 
void addLinkClickEvent_Leg (GameObject go)
 
delegate void WMG_Pie_Slice_Click_H (WMG_Pie_Graph pieGraph, WMG_Pie_Graph_Slice aSlice, PointerEventData pointerEventData)
 
void addPieSliceClickEvent (GameObject go)
 
delegate void WMG_Pie_Legend_Entry_Click_H (WMG_Pie_Graph pieGraph, WMG_Legend_Entry legendEntry, PointerEventData pointerEventData)
 
void addPieLegendEntryClickEvent (GameObject go)
 
delegate void WMG_Ring_Click_H (WMG_Ring ring, PointerEventData pointerEventData)
 
void addRingClickEvent (GameObject go)
 
delegate void WMG_MouseEnter_H (WMG_Series aSeries, WMG_Node aNode, bool state)
 
void addNodeMouseEnterEvent (GameObject go)
 
delegate void WMG_Link_MouseEnter_H (WMG_Series aSeries, WMG_Link aLink, bool state)
 
void addLinkMouseEnterEvent (GameObject go)
 
delegate void WMG_MouseEnter_Leg_H (WMG_Series aSeries, WMG_Node aNode, bool state)
 
void addNodeMouseEnterEvent_Leg (GameObject go)
 
delegate void WMG_Link_MouseEnter_Leg_H (WMG_Series aSeries, WMG_Link aLink, bool state)
 
void addLinkMouseEnterEvent_Leg (GameObject go)
 
delegate void WMG_Pie_Slice_MouseEnter_H (WMG_Pie_Graph pieGraph, WMG_Pie_Graph_Slice aSlice, bool state)
 
void addPieSliceMouseEnterEvent (GameObject go)
 
delegate void WMG_Ring_MouseEnter_H (WMG_Ring ring, bool state)
 
void addRingMouseEnterEvent (GameObject go)
 
void addNodeMouseLeaveEvent (GameObject go)
 
void addLinkMouseLeaveEvent (GameObject go)
 
void addNodeMouseLeaveEvent_Leg (GameObject go)
 
void addLinkMouseLeaveEvent_Leg (GameObject go)
 
- Public Member Functions inherited from WMG_GUI_Functions
void SetActive (GameObject obj, bool state)
 
bool activeInHierarchy (GameObject obj)
 
void SetActiveAnchoredSprite (GameObject obj, bool state)
 
void SetActiveImage (GameObject obj, bool state)
 
Texture2D getTexture (GameObject obj)
 
void setTexture (GameObject obj, Sprite sprite)
 
void changeSpriteFill (GameObject obj, float fill)
 
void changeRadialSpriteRotation (GameObject obj, Vector3 newRot)
 
void changeSpriteColor (GameObject obj, Color aColor)
 
void changeSpriteAlpha (GameObject obj, float alpha)
 
float getSpriteAlpha (GameObject obj)
 
void changeSpriteWidth (GameObject obj, int aWidth)
 
void changeSpriteHeight (GameObject obj, int aHeight)
 
void setTextureMaterial (GameObject obj, Material aMat)
 
Material getTextureMaterial (GameObject obj)
 
void changeSpriteSize (GameObject obj, int aWidth, int aHeight)
 
void changeSpriteSizeFloat (GameObject obj, float aWidth, float aHeight)
 
Vector2 getSpriteSize (GameObject obj)
 
void changeBarWidthHeight (GameObject obj, int aWidth, int aHeight)
 
float getSpriteWidth (GameObject obj)
 
float getSpriteHeight (GameObject obj)
 
float getTextWidth (GameObject obj)
 
float getTextHeight (GameObject obj)
 
void forceUpdateText (GameObject obj)
 
void setAnchor (GameObject go, Vector2 anchor, Vector2 pivot, Vector2 anchoredPosition)
 
void setAnchoredPosition (GameObject go, Vector2 anchoredPosition)
 
void stretchToParent (GameObject go)
 
bool rectIntersectRect (GameObject r1, GameObject r2)
 
void getRectDiffs (GameObject child, GameObject container, ref Vector2 xDif, ref Vector2 yDif)
 
float getSpritePositionX (GameObject obj)
 
float getSpritePositionY (GameObject obj)
 
Vector2 getSpritePositionXY (GameObject obj)
 
float getSpritePivotTopToBot (GameObject obj)
 
Vector3 getPositionRelativeTransform (GameObject obj, GameObject relative)
 
void changePositionByRelativeTransform (GameObject obj, GameObject relative, Vector2 delta)
 
void changeSpritePositionTo (GameObject obj, Vector3 newPos)
 
void changeSpritePositionToX (GameObject obj, float newPos)
 
void changeSpritePositionToY (GameObject obj, float newPos)
 
Vector2 getChangeSpritePositionTo (GameObject obj, Vector2 newPos)
 
void changeSpritePositionRelativeToObjBy (GameObject obj, GameObject relObj, Vector3 changeAmt)
 
void changeSpritePositionRelativeToObjByX (GameObject obj, GameObject relObj, float changeAmt)
 
void changeSpritePositionRelativeToObjByY (GameObject obj, GameObject relObj, float changeAmt)
 
Vector2 getSpritePivot (GameObject obj)
 
void changeSpriteParent (GameObject child, GameObject parent)
 
void getFirstCanvasOnSelfOrParent (Transform trans, ref Canvas canv)
 
void addRaycaster (GameObject obj)
 
void setAsNotInteractible (GameObject obj)
 
void bringSpriteToFront (GameObject obj)
 
void sendSpriteToBack (GameObject obj)
 
- Public Member Functions inherited from WMG_Text_Functions
void changeLabelText (GameObject obj, string aText)
 
void changeLabelFontSize (GameObject obj, int newFontSize)
 
Vector2 getTextSize (GameObject obj)
 
void changeSpritePivot (GameObject obj, WMGpivotTypes theType)
 
void changeLabelColor (GameObject obj, Color newColor)
 
void changeLabelFontStyle (GameObject obj, FontStyle newFontStyle)
 
void changeLabelFont (GameObject obj, Font newFont)
 

Public Attributes

GameObject nodeParent
 The parent of all the nodes. More...
 
GameObject linkParent
 The parent of all the links. More...
 
Object defaultNodePrefab
 The default node prefab used to create all nodes, which is used unless nodePrefabs is populated. More...
 
Object linkPrefab
 The prefab used to create all links. More...
 
int numNodes
 The total number of nodes in this tree (excluding invisible nodes). More...
 
int numLinks
 The total number of links in this tree. More...
 
List< Object > nodePrefabs
 Can be used to specify individual prefabs for each node. More...
 
List< int > nodeColumns
 Each element in this list represents a node (excluding invisible nodes), and this value is the node's column position. More...
 
List< int > nodeRows
 Each element in this list represents a node (excluding invisible nodes), and this value is the node's row position. More...
 
List< int > linkNodeFromIDs
 This is the list of links and each link's from node. More...
 
List< int > linkNodeToIDs
 Same as linkNodeFromIDs, except this is the to node or the ending point for the links. More...
 
Object invisibleNodePrefab
 The invisible node prefab. More...
 
int numInvisibleNodes
 The number of invisible nodes. More...
 
List< int > invisibleNodeColumns
 Invisible nodes are used to create angled links where no node appears. More...
 
List< int > invisibleNodeRows
 Invisible nodes are used to create angled links where no node appears. More...
 
WMG_Change_Obj resizeC = new WMG_Change_Obj()
 

Properties

ResizeProperties resizeProperties [get, set]
 Specifies which graph content is resized when resizeEnabled = true. More...
 
bool resizeEnabled [get, set]
 Determines whether graph content (resizeProperties) will resize post graph initialization based on the percentage change of the graph's rect transform width / height. More...
 
int nodeWidthHeight [get, set]
 Determines the width and height of all nodes. More...
 
float nodeRadius [get, set]
 This is the radius of all circle nodes or half the width / height of all square nodes. More...
 
bool squareNodes [get, set]
 This sets a boolean on all nodes to tell whether or not the node is represented as a square instead of a circle. More...
 
- Properties inherited from WMG_Graph_Manager
List< GameObject > NodesParent [get]
 The list of GameObjects which are WMG_Nodes for this graph. More...
 
List< GameObject > LinksParent [get]
 The list of GameObjects which are WMG_Links for this graph. More...
 

Additional Inherited Members

- Events inherited from WMG_Events
WMG_Click_H WMG_Click
 Occurs when a series point is clicked. More...
 
WMG_Link_Click_H WMG_Link_Click
 Occurs when a series link / line is clicked. More...
 
WMG_Click_Leg_H WMG_Click_Leg
 Occurs when a series legend node / swatch is clicked. More...
 
WMG_Link_Click_Leg_H WMG_Link_Click_Leg
 Occurs when a series legend link / line is clicked. More...
 
WMG_Pie_Slice_Click_H WMG_Pie_Slice_Click
 Occurs when a pie graph slice is clicked. More...
 
WMG_Pie_Legend_Entry_Click_H WMG_Pie_Legend_Entry_Click
 Occurs when a pie graph legend swatch is clicked. More...
 
WMG_Ring_Click_H WMG_Ring_Click
 Occurs when a ring graph ring / band is clicked. More...
 
WMG_MouseEnter_H WMG_MouseEnter
 Occurs when a series point is hovered. More...
 
WMG_Link_MouseEnter_H WMG_Link_MouseEnter
 Occurs when a series link / line is hovered. More...
 
WMG_MouseEnter_Leg_H WMG_MouseEnter_Leg
 Occurs when a series legend node / swatch is hovered. More...
 
WMG_Link_MouseEnter_Leg_H WMG_Link_MouseEnter_Leg
 Occurs when a series legend link / line is hovered. More...
 
WMG_Pie_Slice_MouseEnter_H WMG_Pie_Slice_MouseEnter
 Occurs when a pie graph slice is hovered. More...
 
WMG_Ring_MouseEnter_H WMG_Ring_MouseEnter
 Occurs when a ring graph ring / band is hovered. More...
 

Detailed Description

A class used for creating hierarchical tree type graphs.

Member Enumeration Documentation

◆ ResizeProperties

Enumerator
NodeWidthHeight 
NodeRadius 

Member Function Documentation

◆ getNodesInColumn()

List<GameObject> WMG_Hierarchical_Tree.getNodesInColumn ( int  colNum)

Gets the nodes in the specified column.

Returns
The nodes in column.
Parameters
colNumCol number.

◆ getNodesInRow()

List<GameObject> WMG_Hierarchical_Tree.getNodesInRow ( int  rowNum)

Gets the nodes in the specified row.

Returns
The nodes in row.
Parameters
rowNumRow number.

◆ Init()

void WMG_Hierarchical_Tree.Init ( )

Initializes this graph, and should be called before anything else.

◆ Refresh()

void WMG_Hierarchical_Tree.Refresh ( )

Refreshes the graph, and happens automatically in Update(), but sometimes it is useful or necessary to call this manually, note that refresh updates only the parts of the graph affected by properties that have changed since a last refresh.

◆ setOriginalPropertyValues()

void WMG_Hierarchical_Tree.setOriginalPropertyValues ( )

Caches initial property values that are used as the basis for resizeEnabled functionality, called automatically during Init.

Member Data Documentation

◆ defaultNodePrefab

Object WMG_Hierarchical_Tree.defaultNodePrefab

The default node prefab used to create all nodes, which is used unless nodePrefabs is populated.

◆ invisibleNodeColumns

List<int> WMG_Hierarchical_Tree.invisibleNodeColumns

Invisible nodes are used to create angled links where no node appears.

This is the invisible node equivalent of nodeColumns.

◆ invisibleNodePrefab

Object WMG_Hierarchical_Tree.invisibleNodePrefab

The invisible node prefab.

◆ invisibleNodeRows

List<int> WMG_Hierarchical_Tree.invisibleNodeRows

Invisible nodes are used to create angled links where no node appears.

This is the invisible node equivalent of nodeRows.

◆ linkNodeFromIDs

List<int> WMG_Hierarchical_Tree.linkNodeFromIDs

This is the list of links and each link's from node.

The ID here corresponds to the element in the nodeColumns list. For example node column element 0 is node ID 1. This list also applies for invisible nodes, however the node IDs will be denoted by a negative number.

◆ linkNodeToIDs

List<int> WMG_Hierarchical_Tree.linkNodeToIDs

Same as linkNodeFromIDs, except this is the to node or the ending point for the links.

◆ linkParent

GameObject WMG_Hierarchical_Tree.linkParent

The parent of all the links.

◆ linkPrefab

Object WMG_Hierarchical_Tree.linkPrefab

The prefab used to create all links.

◆ nodeColumns

List<int> WMG_Hierarchical_Tree.nodeColumns

Each element in this list represents a node (excluding invisible nodes), and this value is the node's column position.

◆ nodeParent

GameObject WMG_Hierarchical_Tree.nodeParent

The parent of all the nodes.

◆ nodePrefabs

List<Object> WMG_Hierarchical_Tree.nodePrefabs

Can be used to specify individual prefabs for each node.

◆ nodeRows

List<int> WMG_Hierarchical_Tree.nodeRows

Each element in this list represents a node (excluding invisible nodes), and this value is the node's row position.

◆ numInvisibleNodes

int WMG_Hierarchical_Tree.numInvisibleNodes

The number of invisible nodes.

◆ numLinks

int WMG_Hierarchical_Tree.numLinks

The total number of links in this tree.

◆ numNodes

int WMG_Hierarchical_Tree.numNodes

The total number of nodes in this tree (excluding invisible nodes).

◆ resizeC

WMG_Change_Obj WMG_Hierarchical_Tree.resizeC = new WMG_Change_Obj()

Property Documentation

◆ nodeRadius

float WMG_Hierarchical_Tree.nodeRadius
getset

This is the radius of all circle nodes or half the width / height of all square nodes.

This determine the starting and ending points for the links.

The node radius.

◆ nodeWidthHeight

int WMG_Hierarchical_Tree.nodeWidthHeight
getset

Determines the width and height of all nodes.

◆ resizeEnabled

bool WMG_Hierarchical_Tree.resizeEnabled
getset

Determines whether graph content (resizeProperties) will resize post graph initialization based on the percentage change of the graph's rect transform width / height.

true if resize enabled; otherwise, false.

◆ resizeProperties

ResizeProperties WMG_Hierarchical_Tree.resizeProperties
getset

Specifies which graph content is resized when resizeEnabled = true.

The resize properties.

◆ squareNodes

bool WMG_Hierarchical_Tree.squareNodes
getset

This sets a boolean on all nodes to tell whether or not the node is represented as a square instead of a circle.

Square nodes will have the effect of making the link start and end points be based on the square's edge.

true if square nodes; otherwise, false.


The documentation for this class was generated from the following file: