Graph Maker
|
Class used for creating pie graphs. More...
Public Types | |
enum | sortMethod { sortMethod.None, sortMethod.Largest_First, sortMethod.Smallest_First, sortMethod.Alphabetically, sortMethod.Reverse_Alphabetically } |
enum | ResizeProperties { ResizeProperties.LabelExplodeLength = 1 << 0, ResizeProperties.LabelFontSize = 1 << 1, ResizeProperties.LegendFontSize = 1 << 2, ResizeProperties.LegendSwatchSize = 1 << 3, ResizeProperties.LegendEntrySize = 1 << 4, ResizeProperties.LegendOffset = 1 << 5, ResizeProperties.AutoCenterPadding = 1 << 6 } |
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 | |
List< GameObject > | getSlices () |
Get the pie slices. More... | |
void | Init () |
Initializes the graph, and should always be done before anything else, called automatically in Start(), but it never hurts to call this manually after instantiating a graph prefab. 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... | |
void | updateBG (int thePieSize) |
Vector3 | getCalloutSlicePosition (string label, float amt) |
Given a pie slice (identified by its label string), and floating point amount of space, return a new pie slice position that can be used to animate pie slices outwards during for example a mouse click event. More... | |
Vector3 | getPositionFromExplode (WMG_Pie_Graph_Slice slice, float amt) |
Given a pie slice, and floating point amount of space, return a new pie slice position that can be used to animate pie slices outwards during for example a mouse click event. 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_Link > | FindShortestPathBetweenNodes (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_Link > | FindShortestPathBetweenNodesWeighted (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 | |
WMG_List< float > | sliceValues = new WMG_List<float>() |
The values each pie slice represents. More... | |
WMG_List< string > | sliceLabels = new WMG_List<string>() |
The text labels each pie slice represents. More... | |
WMG_List< Color > | sliceColors = new WMG_List<Color>() |
The color of each pie slice. More... | |
WMG_Data_Source | sliceValuesDataSource |
Reference to WMG_Data_Source which can be used to populate sliceValues. More... | |
WMG_Data_Source | sliceLabelsDataSource |
Reference to WMG_Data_Source which can be used to populate sliceLabels. More... | |
WMG_Data_Source | sliceColorsDataSource |
Reference to WMG_Data_Source which can be used to populate sliceColors. More... | |
GameObject | background |
The background object. More... | |
GameObject | backgroundCircle |
The background circle sprite. More... | |
GameObject | slicesParent |
The pie slices parent. More... | |
WMG_Legend | legend |
The legend. More... | |
Object | legendEntryPrefab |
The prefab used to create each legend entry for each pie slice. More... | |
Object | nodePrefab |
The prefab used to create the pie slices. More... | |
Dictionary< string, WMG_Pie_Graph_Slice > | LabelToSliceMap = new Dictionary<string, WMG_Pie_Graph_Slice>() |
Mapping of slice labels from sliceLabels to WMG_Pie_Graph_Slice. More... | |
WMG_Change_Obj | graphC = new WMG_Change_Obj() |
Properties | |
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... | |
ResizeProperties | resizeProperties [get, set] |
Specifies which graph content is resized when resizeEnabled = true. More... | |
Vector2 | leftRightPadding [get, set] |
Gets or sets the left right padding. More... | |
Vector2 | topBotPadding [get, set] |
Gets or sets the top bot padding. More... | |
float | bgCircleOffset [get, set] |
Controls how much space is between the background circle sprite and the pie slice outer edges. More... | |
bool | autoCenter [get, set] |
When enabled, ensures the pie graph and legend both stay in the center of the graph's rect transform. More... | |
float | autoCenterMinPadding [get, set] |
When autoCenter = true, controls how much padding there is between the pie graph and its rect transform bounds. More... | |
sortMethod | sortBy [get, set] |
This controls the order that the pie slices appear. More... | |
bool | swapColorsDuringSort [get, set] |
When set to true, if the 3rd slice is green and the 3rd slice value gets increased so that it becomes the first slice after sorting, then the green color will swap to be in the top right slice. More... | |
WMG_Enums.labelTypes | sliceLabelType [get, set] |
Controls how the labels on the slices display. More... | |
float | explodeLength [get, set] |
This is the radial distance the pie slices are from the center. More... | |
bool | explodeSymmetrical [get, set] |
When the explode length is > 0, this determines whether the outer edge of the slices align. More... | |
bool | useDoughnut [get, set] |
Whether or not to carve out a center circle to create a doughnut graph. More... | |
float | doughnutPercentage [get, set] |
When useDoughnut = true, controls the size of the center circle carved out of the graph. More... | |
bool | limitNumberSlices [get, set] |
When enabled, the pie graph will limit the number of slices displayed. More... | |
bool | includeOthers [get, set] |
When limitNumberSlices = true, and has cut out some slices, then this determines whether to lump all of the slices that got excluded into an others slice. More... | |
int | maxNumberSlices [get, set] |
When limitNumberSlices = true, this determines the maximum number of slices that are displayed not including the others slice if includeOthers = true. More... | |
string | includeOthersLabel [get, set] |
When includeOthers = true, this is the text label given to the others slice. More... | |
Color | includeOthersColor [get, set] |
When includeOthers = true, this is the others slice color. More... | |
float | animationDuration [get, set] |
Gets or sets the duration of the animation. More... | |
float | sortAnimationDuration [get, set] |
Gets or sets the duration of the sort animation. More... | |
float | sliceLabelExplodeLength [get, set] |
Gets or sets the length of space the slice labels appear relative to the outer edge of the slices. More... | |
int | sliceLabelFontSize [get, set] |
Gets or sets the size of the slice labels. More... | |
int | numberDecimalsInPercents [get, set] |
Gets or sets the number decimals displayed in value labels. More... | |
Color | sliceLabelColor [get, set] |
Gets or sets the color of the slice labels. More... | |
bool | hideZeroValueLegendEntry [get, set] |
If a pie slice has a value of 0, do not show it in the legend. More... | |
bool | interactivityEnabled [get, set] |
Whether to raise mouse click / hover events for this pie graph. More... | |
float | pieSize [get] |
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... | |
Class used for creating pie graphs.
|
strong |
|
strong |
Vector3 WMG_Pie_Graph.getCalloutSlicePosition | ( | string | label, |
float | amt | ||
) |
Given a pie slice (identified by its label string), and floating point amount of space, return a new pie slice position that can be used to animate pie slices outwards during for example a mouse click event.
label | Label. |
amt | Amt. |
Vector3 WMG_Pie_Graph.getPositionFromExplode | ( | WMG_Pie_Graph_Slice | slice, |
float | amt | ||
) |
Given a pie slice, and floating point amount of space, return a new pie slice position that can be used to animate pie slices outwards during for example a mouse click event.
slice | Slice. |
amt | Amt. |
List<GameObject> WMG_Pie_Graph.getSlices | ( | ) |
Get the pie slices.
void WMG_Pie_Graph.Init | ( | ) |
Initializes the graph, and should always be done before anything else, called automatically in Start(), but it never hurts to call this manually after instantiating a graph prefab.
void WMG_Pie_Graph.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.
void WMG_Pie_Graph.updateBG | ( | int | thePieSize | ) |
GameObject WMG_Pie_Graph.background |
The background object.
GameObject WMG_Pie_Graph.backgroundCircle |
The background circle sprite.
WMG_Change_Obj WMG_Pie_Graph.graphC = new WMG_Change_Obj() |
Dictionary<string, WMG_Pie_Graph_Slice> WMG_Pie_Graph.LabelToSliceMap = new Dictionary<string, WMG_Pie_Graph_Slice>() |
Mapping of slice labels from sliceLabels to WMG_Pie_Graph_Slice.
WMG_Legend WMG_Pie_Graph.legend |
The legend.
Object WMG_Pie_Graph.legendEntryPrefab |
The prefab used to create each legend entry for each pie slice.
Object WMG_Pie_Graph.nodePrefab |
The prefab used to create the pie slices.
WMG_Data_Source WMG_Pie_Graph.sliceColorsDataSource |
Reference to WMG_Data_Source which can be used to populate sliceColors.
The text labels each pie slice represents.
WMG_Data_Source WMG_Pie_Graph.sliceLabelsDataSource |
Reference to WMG_Data_Source which can be used to populate sliceLabels.
GameObject WMG_Pie_Graph.slicesParent |
The pie slices parent.
The values each pie slice represents.
WMG_Data_Source WMG_Pie_Graph.sliceValuesDataSource |
Reference to WMG_Data_Source which can be used to populate sliceValues.
|
getset |
Gets or sets the duration of the animation.
The duration of the animation.
|
getset |
When enabled, ensures the pie graph and legend both stay in the center of the graph's rect transform.
This will automatically adjust the background padding as well, using autoCenterMinPadding as the minimum for the padding.
true
if auto center; otherwise, false
.
|
getset |
When autoCenter = true, controls how much padding there is between the pie graph and its rect transform bounds.
The auto center minimum padding.
|
getset |
Controls how much space is between the background circle sprite and the pie slice outer edges.
The background circle offset.
|
getset |
When useDoughnut = true, controls the size of the center circle carved out of the graph.
The doughnut percentage.
|
getset |
This is the radial distance the pie slices are from the center.
A small value here usually enhances the visual appeal of the graph.
The length of the explode.
|
getset |
When the explode length is > 0, this determines whether the outer edge of the slices align.
true
if explode symmetrical; otherwise, false
.
|
getset |
If a pie slice has a value of 0, do not show it in the legend.
true
if hide zero value legend entry; otherwise, false
.
|
getset |
When limitNumberSlices = true, and has cut out some slices, then this determines whether to lump all of the slices that got excluded into an others slice.
true
if include others; otherwise, false
.
|
getset |
When includeOthers = true, this is the others slice color.
The color of the include others.
|
getset |
When includeOthers = true, this is the text label given to the others slice.
The include others label.
|
getset |
Whether to raise mouse click / hover events for this pie graph.
true
if interactivity enabled; otherwise, false
.
|
getset |
Gets or sets the left right padding.
The left right padding.
|
getset |
When enabled, the pie graph will limit the number of slices displayed.
So if there are 10 values, and 3 is set maxNumberSlices, then only 3 of the 10 will be used, the 3 used depends on sortBy.
true
if limit number slices; otherwise, false
.
|
getset |
When limitNumberSlices = true, this determines the maximum number of slices that are displayed not including the others slice if includeOthers = true.
The max number slices.
|
getset |
Gets or sets the number decimals displayed in value labels.
The number decimals in percents.
|
get |
|
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
.
|
getset |
Specifies which graph content is resized when resizeEnabled = true.
The resize properties.
|
getset |
Gets or sets the color of the slice labels.
The color of the slice label.
|
getset |
Gets or sets the length of space the slice labels appear relative to the outer edge of the slices.
The length of the slice label explode.
|
getset |
Gets or sets the size of the slice labels.
The size of the slice label font.
|
getset |
Controls how the labels on the slices display.
The type of the slice label.
|
getset |
Gets or sets the duration of the sort animation.
The duration of the sort animation.
|
getset |
This controls the order that the pie slices appear.
The default is Largest_First, meaning that the slice with the highest value will appear in the top right, and subsequent slices go in clockwise order. For "None" sorting, the slice value corresponding to the 0 index of the Values list appears in the top right corner.
The sort by.
|
getset |
When set to true, if the 3rd slice is green and the 3rd slice value gets increased so that it becomes the first slice after sorting, then the green color will swap to be in the top right slice.
If this is set to false, then the colors remain static, meaning green will always be the third slice.
true
if swap colors during sort; otherwise, false
.
|
getset |
Gets or sets the top bot padding.
The top bot padding.
|
getset |
Whether or not to carve out a center circle to create a doughnut graph.
true
if use doughnut; otherwise, false
.