Constructor Summary
Public Constructor | ||
public |
constructor(options: object) |
Member Summary
Public Members | ||
public |
|
|
public |
nodeSettings: * |
Private Members | ||
private |
_allowFocus: * |
|
private |
|
|
private |
_allowPan: * |
|
private |
_allowZoom: * |
|
private |
_data: * |
|
private |
_duration: * |
|
private |
_element: * |
|
private |
_getChildren: * |
|
private |
_getId: * |
|
private |
_getParentId: * |
|
private |
|
|
private |
_isFlatData: * |
|
private |
|
|
private |
_links: * |
|
private |
_margins: * |
|
private |
_maxScale: * |
|
private |
_minScale: * |
|
private |
|
|
private |
|
|
private |
_orientation: * |
|
private |
|
|
private |
_root: * |
|
private |
_svg: * |
|
private |
_theme: * |
|
private |
|
|
private |
_view: * |
|
private |
|
|
private |
|
|
private |
|
Method Summary
Public Methods | ||
public |
centerNode(nodeDataItem: *): object Center the view to a D3 tree node. |
|
public |
Collapses the given node data item. |
|
public |
collapseRecursively(nodeDataItem: object): object Collapses the given node data item, and its children and descendants. |
|
public |
Expands the given node data item. |
|
public |
expandRecursively(nodeDataItem: object): object Expands the given node data item, and its children and descendants. |
|
public |
focusToNode(idOrNodeDataItem: *): object Focuses and expands all the way through to a node. |
|
public |
Gets the boolean value indicating whether to focus to the clicked node or not. |
|
public |
Gets the boolean value indicating whether to pan to a clicked node. |
|
public |
Gets the boolean value indicating whether the drag-to-pan pan feature is enabled or not. |
|
public |
Gets the boolean value indicating whether the mouse wheel to zoom in/out feature is enabled or not. |
|
public |
getChildren(dataItem: object): object[] Gets the children data items for a given data item. |
|
public |
Gets the data items used to render the nodes. |
|
public |
getDataItem(id: *): object Get a single data item given an id. |
|
public |
Gets the duration of animations for the tree. |
|
public |
getElement(): object Gets the container DOM element. |
|
public |
Gets the height of SVG, including the margins. |
|
public |
Gets the height of the SVG for the tree diagram. |
|
public |
Gets the ID for a given data item. |
|
public |
Returns a boolean whether the tree is using flat data or not. |
|
public |
Get the array of D3 link data items the D3 tree has generated. |
|
public |
Gets the load on demand settings object. |
|
public |
getMargins(): object Gets the margins for the tree diagram. |
|
public |
Gets the maximum zoom scaling. |
|
public |
Gets the minimum zoom scaling. |
|
public |
Get a single node given an id or a data item. |
|
public |
Gets the node depth multiplier that affects the distance between the parent node and the child node. |
|
public |
Gets the node settings object. |
|
public |
Get the array of D3 node data items the D3 tree has generated. |
|
public |
Gets the tree orientation. |
|
public |
Gets the D3 selection object for the panning container element. |
|
public |
getParentId(dataItem: object): * Gets the parent ID for a given data item. |
|
public |
Gets the root node object. |
|
public |
Gets the D3 selection object for the SVG element. |
|
public |
Gets the tree theme. |
|
public |
Gets the D3 generator object used to generate the tree nodes coordinates. |
|
public |
Gets the D3 selection object for the view element. |
|
public |
getVisibleNodes(): object[] Get the array of visible D3 node data items the D3 tree has generated. |
|
public |
Gets the width of SVG, including the margins. |
|
public |
Gets the width of the SVG for the tree diagram. |
|
public |
Gets the D3 zoom listener used for the panning, zooming and focus features. |
|
public |
hideSiblings(nodeDataItem: object): object Hide the siblings nodes for a given node. |
|
public |
initialize(): object Creates and set up the the tree diagram. |
|
public |
Focuses to a node, given a node data item. |
|
public |
nodeToggle(nodeDataItem: *): object Toggles the children visibility for a given node data item. |
|
public |
Regenerates the node data. |
|
public |
removeSelection(nodeDataItem: object): object Remove node selections for a given node and it's children. |
|
public |
setAllowFocus(newAllowFocus: boolean): object Sets the boolean value indicating whether to focus to the clicked node or not. |
|
public |
setAllowNodeCentering(newAllowNodeCentering: boolean): object Whether to pan to a clicked node. |
|
public |
setAllowPan(newAllowPan: *): object Sets the boolean value indicating whether the drag-to-pan pan feature is enabled or not. |
|
public |
setAllowZoom(newAllowZoom: boolean): object Sets the boolean value indicating whether the mouse wheel to zoom in/out feature is enabled or not. |
|
public |
setChildrenAccessor(newChildrenAccessor: getChildrenCallBack): object Sets the children accessor callback function, defining how to get the children data items from a given data item. |
|
public |
Sets the data items the tree should use to render the nodes. |
|
public |
setDuration(newDuration: *): object Sets the duration of animations for the tree. |
|
public |
setElement(newElement: object): object Sets the container DOM element |
|
public |
setHeightWithoutMargins(newHeightWithoutMargin: *): object Sets the height of the SVG for the tree diagram. |
|
public |
setIdAccessor(newIdAccessor: getIdCallBack): object Sets the ID accessor callback function, defining how to get a unique ID from a given data item. |
|
public |
setIsFlatData(newIsFlatData: boolean): * Sets the is flat data flag. |
|
public |
setMargins(newMargins: object): object Sets the margins for the tree diagram. |
|
public |
setMaxScale(newMaxScale: *): object Sets the maximum zoom scaling. |
|
public |
setMinScale(newMinScale: *): object Sets the minimum zoom scaling. |
|
public |
setNodeDepthMultiplier(newNodeDepthMultiplier: number): object Sets the node depth multiplier value. |
|
public |
setOrientation(orientation: string): object Sets the tree orientation. |
|
public |
setParentIdAccessor(newParentIdAccessor: getParentIdCallBack): object Sets the parent ID accessor callback function, defining how to get the parent ID from a given data item. |
|
public |
Sets the tree theme. |
|
public |
setWidthWithoutMargins(newWidthWithoutMargin: *): object Sets the width of the SVG for the tree diagram. |
|
public |
Updates the tree given a D3 tree node. |
|
public |
Updates the dimensions of the SVG. |
|
public |
updateTreeWithFocusOnNode(nodeDataItem: object): object Updates the tree diagram so only the relevant focused node and direct parent hierarchies are shown. |
|
public |
Validates the settings to ensure the tree diagram is ready to be generated. |
Private Methods | ||
private |
_addUnderlyingChildNode(parentNodeDataItem: object, dataItem: object): object Creates and adds a child D3 tree node to a given parent D3 tree node. |
|
private |
_createNode(parentNodeDataItem: object, dataItem: object): object Creates a child D3 tree node. |
|
private |
Gets the path generator used to render the links between the nodes. |
|
private |
_getNodeSize(): number[] Called when updating dimensions when node settings is configured to be 'nodesize'. |
|
private |
_linkEnter(source: *, linkEnter: *, links: *, linkPathGenerator: *): object Defines how to create the links for newly added data objects. |
|
private |
_linkExit(source: object, linkExit: *, linkExitTransition: *, links: *, linkPathGenerator: *): object Defines how to remove the links for the removed data objects. |
|
private |
_linkUpdate(source: *, linkUpdate: *, linkUpdateTransition: *, links: *, linkPathGenerator: *): object Defines how to update the links for the data objects. |
|
private |
_nodeEnter(nodeEnter: *, nodes: *): object Defines how to create the nodes for newly added data objects. |
|
private |
Defines how to remove the nodes for the removed data objects. |
|
private |
_nodeUpdate(nodeUpdate: *, nodeUpdateTransition: *, nodes: *): object Defines how to update the nodes for the data objects. |
|
private |
_onNodeClick(nodeDataItem: object, index: number, arr: object[]): boolean Triggers the nodeClick event when a D3 node is clicked on, and proceeds to focus/expand/collapse the node. |
|
private |
_populateUnderlyingChildren(nodeDataItem: object): object Populates the node's children to a hidden property. |
|
private |
_processLoadedDataForNodeFocus(nodeDataItem: object, result: object[]): object Process the loaded data from AJAX resulting from a node expand. |
|
private |
_processLoadedDataForNodeToggle(nodeDataItem: object, result: object[]): object Process the loaded data from AJAX resulting from a node toggle. |
|
private |
_updateLinks(nodeDataItem: object, links: object[]): object Updates the tree node links given a D3 tree node. |
|
private |
_updateNodes(nodeDataItem: object, nodes: object[]): object Updates the tree nodes given a D3 tree node. |
Public Constructors
public constructor(options: object) source
Params:
Name | Type | Attribute | Description |
options | object | The options object. |
|
options.theme | string |
|
The theme of the tree. |
options.orientation | string |
|
The orientation of the tree. |
options.allowPan | boolean |
|
Enables/disables the mouse drag to pan feature. |
options.allowZoom | boolean |
|
Enables/disables the mouse wheel to zoom feature. |
options.allowFocus | boolean |
|
If true, clicking on a node would focus to the node, hiding all irrelevant nodes that's not a parent, ancestor, or sibling. |
options.allowNodeCentering | boolean |
|
If true, clicking on a node would pan to the node. |
options.minScale | number |
|
Minimum zoom scaling. |
options.maxScale | number |
|
Maximum zoom scaling. |
options.nodeDepthMultiplier | number |
|
The distance between the parent and child nodes. |
options.isFlatData | boolean |
|
Indicates whether the passed data was a flat array of objects. If true, you must specify the |
options.getId | getIdCallBack | ||
options.getParentId | getParentIdCallBack |
|
|
options.getChildren | getChildrenCallBack |
|
|
options.widthWithoutMargins | number |
|
The width of the tree, not including the margins. |
options.heightWithoutMargins | number |
|
The height of the tree, not including the margins. |
options.margins | object |
|
Object specifying the margins of the tree diagram. |
options.margins.top | number |
|
The top margin for the tree diagram. |
options.margins.right | number |
|
The right margin for the tree diagram. |
options.margins.bottom | number |
|
The bottom margin for the tree diagram. |
options.margins.left | number |
|
The left margin for the tree diagram. |
options.duration | number |
|
Integer in milliseconds determining the duration of the animations for the tree. |
options.loadOnDemandSettings | LoadOnDemandSettings |
|
Object specifying the load-on-demand settings. |
options.nodeSettings | NodeSettings |
|
Object specifying the node settings for the tree. |
Public Members
public loadOnDemandSettings: * source
public nodeSettings: * source
Private Members
private _allowFocus: * source
private _allowNodeCentering: * source
private _allowPan: * source
private _allowZoom: * source
private _data: * source
private _duration: * source
private _element: * source
private _getChildren: * source
private _getId: * source
private _getParentId: * source
private _heightWithoutMargin: * source
private _isFlatData: * source
private _linkPathGenerator: * source
private _links: * source
private _margins: * source
private _maxScale: * source
private _minScale: * source
private _nodeDepthMultiplier: * source
private _orientation: * source
private _panningContainer: * source
private _root: * source
private _svg: * source
private _theme: * source
private _treeGenerator: * source
private _view: * source
private _visibleNodes: * source
private _widthWithoutMargin: * source
private _zoomListener: * source
Public Methods
public centerNode(nodeDataItem: *): object source
Center the view to a D3 tree node.
Params:
Name | Type | Attribute | Description |
nodeDataItem | * | The D3 node data item to focus on. |
public collapse(nodeDataItem: object): object source
Collapses the given node data item.
Params:
Name | Type | Attribute | Description |
nodeDataItem | object | The D3 node data item to collapse. |
public collapseRecursively(nodeDataItem: object): object source
Collapses the given node data item, and its children and descendants.
Params:
Name | Type | Attribute | Description |
nodeDataItem | object | The D3 node data item to collapse. |
public expand(nodeDataItem: object): object source
Expands the given node data item.
Params:
Name | Type | Attribute | Description |
nodeDataItem | object | The D3 node data item to expand. |
public expandRecursively(nodeDataItem: object): object source
Expands the given node data item, and its children and descendants.
Params:
Name | Type | Attribute | Description |
nodeDataItem | object | The D3 node data item to expand. |
public focusToNode(idOrNodeDataItem: *): object source
Focuses and expands all the way through to a node.
Params:
Name | Type | Attribute | Description |
idOrNodeDataItem | * | The id of the node to focus, or the node data item object. |
public getAllowFocus(): boolean source
Gets the boolean value indicating whether to focus to the clicked node or not. Focusing on a node would hide all irrelevant nodes that's not a parent, sibling or ancestor of the clicked node.
public getAllowNodeCentering(): boolean source
Gets the boolean value indicating whether to pan to a clicked node.
public getAllowPan(): boolean source
Gets the boolean value indicating whether the drag-to-pan pan feature is enabled or not.
public getAllowZoom(): boolean source
Gets the boolean value indicating whether the mouse wheel to zoom in/out feature is enabled or not.
public getChildren(dataItem: object): object[] source
Gets the children data items for a given data item.
Params:
Name | Type | Attribute | Description |
dataItem | object | The data item to get the children data items from. |
public getDataItem(id: *): object source
Get a single data item given an id.
Params:
Name | Type | Attribute | Description |
id | * | The ID to retrieve the data item with. |
public getHeightWithoutMargins(): number source
Gets the height of the SVG for the tree diagram. Does not include the margins.
public getId(dataItem: object): * source
Gets the ID for a given data item.
Params:
Name | Type | Attribute | Description |
dataItem | object | The data item to get the ID from. |
Return:
* | The ID for the given data item. |
public getIsFlatData(): boolean source
Returns a boolean whether the tree is using flat data or not.
public getLoadOnDemandSettings(): LoadOnDemandSettings source
Gets the load on demand settings object.
public getNode(idOrDataItem: * | object): object source
Get a single node given an id or a data item.
Params:
Name | Type | Attribute | Description |
idOrDataItem | * | object | The ID or data item to retrieve the D3 tree node data item with. |
public getNodeDepthMultiplier(): number source
Gets the node depth multiplier that affects the distance between the parent node and the child node.
public getPanningContainer(): object source
Gets the D3 selection object for the panning container element.
public getParentId(dataItem: object): * source
Gets the parent ID for a given data item.
Params:
Name | Type | Attribute | Description |
dataItem | object | The data item to get the parent ID from. |
Return:
* | The parent ID for the given data item. |
public getTreeGenerator(): function source
Gets the D3 generator object used to generate the tree nodes coordinates.
public getVisibleNodes(): object[] source
Get the array of visible D3 node data items the D3 tree has generated.
public getWidthWithoutMargins(): number source
Gets the width of the SVG for the tree diagram. Does not include the margins.
public getZoomListener(): function source
Gets the D3 zoom listener used for the panning, zooming and focus features.
public hideSiblings(nodeDataItem: object): object source
Hide the siblings nodes for a given node.
Params:
Name | Type | Attribute | Description |
nodeDataItem | object | The D3 node to hide siblings for. |
public nodeFocus(nodeDataItem: object): object source
Focuses to a node, given a node data item.
Params:
Name | Type | Attribute | Description |
nodeDataItem | object | The node being focused on. |
public nodeToggle(nodeDataItem: *): object source
Toggles the children visibility for a given node data item.
Params:
Name | Type | Attribute | Description |
nodeDataItem | * | D3 Node data item. |
public removeSelection(nodeDataItem: object): object source
Remove node selections for a given node and it's children.
Params:
Name | Type | Attribute | Description |
nodeDataItem | object | The D3 node data item to remove selection from. |
public setAllowFocus(newAllowFocus: boolean): object source
Sets the boolean value indicating whether to focus to the clicked node or not. Focusing on a node would hide all irrelevant nodes that's not a parent, sibling or ancestor of the clicked node.
Params:
Name | Type | Attribute | Description |
newAllowFocus | boolean | Whether to pan to the clicked node. |
public setAllowNodeCentering(newAllowNodeCentering: boolean): object source
Whether to pan to a clicked node.
Params:
Name | Type | Attribute | Description |
newAllowNodeCentering | boolean | Whether to pan to the clicked node. |
public setAllowPan(newAllowPan: *): object source
Sets the boolean value indicating whether the drag-to-pan pan feature is enabled or not.
Params:
Name | Type | Attribute | Description |
newAllowPan | * | Whether panning is enabled or not. |
public setAllowZoom(newAllowZoom: boolean): object source
Sets the boolean value indicating whether the mouse wheel to zoom in/out feature is enabled or not.
Params:
Name | Type | Attribute | Description |
newAllowZoom | boolean | Whether zooming is enabled or not. |
public setChildrenAccessor(newChildrenAccessor: getChildrenCallBack): object source
Sets the children accessor callback function, defining how to get the children data items from a given data item.
Params:
Name | Type | Attribute | Description |
newChildrenAccessor | getChildrenCallBack | Callback function to get the children for a given data item. |
public setData(newData: object[]): object source
Sets the data items the tree should use to render the nodes.
Params:
Name | Type | Attribute | Description |
newData | object[] | The new set of data items. |
public setDuration(newDuration: *): object source
Sets the duration of animations for the tree.
Params:
Name | Type | Attribute | Description |
newDuration | * | The animation duration in milliseconds. |
public setElement(newElement: object): object source
Sets the container DOM element
Params:
Name | Type | Attribute | Description |
newElement | object | The container DOM element. |
public setHeightWithoutMargins(newHeightWithoutMargin: *): object source
Sets the height of the SVG for the tree diagram.
Params:
Name | Type | Attribute | Description |
newHeightWithoutMargin | * | The height of SVG for the tree diagram. |
public setIdAccessor(newIdAccessor: getIdCallBack): object source
Sets the ID accessor callback function, defining how to get a unique ID from a given data item.
Params:
Name | Type | Attribute | Description |
newIdAccessor | getIdCallBack | Callback function to get the ID for a given data item. |
public setIsFlatData(newIsFlatData: boolean): * source
Sets the is flat data flag.
If set to true, you must specify
the getParentId
option.
Params:
Name | Type | Attribute | Description |
newIsFlatData | boolean | Whether the tree is using flat data or not. |
Return:
* |
public setMargins(newMargins: object): object source
Sets the margins for the tree diagram.
Params:
Name | Type | Attribute | Description |
newMargins | object | The margin object. |
|
newMargins.top | number | The margin top for the tree diagram. |
|
newMargins.right | number | The margin right for the tree diagram. |
|
newMargins.bottom | number | The margin bottom for the tree diagram. |
|
newMargins.left | number | The margin left for the tree diagram. |
public setMaxScale(newMaxScale: *): object source
Sets the maximum zoom scaling.
Params:
Name | Type | Attribute | Description |
newMaxScale | * | The maximum zoom scale value. |
public setMinScale(newMinScale: *): object source
Sets the minimum zoom scaling.
Params:
Name | Type | Attribute | Description |
newMinScale | * | The minimum zoom scale value. |
public setNodeDepthMultiplier(newNodeDepthMultiplier: number): object source
Sets the node depth multiplier value.
Params:
Name | Type | Attribute | Description |
newNodeDepthMultiplier | number | The value that affects the distance between the parent node and the child node. |
public setOrientation(orientation: string): object source
Sets the tree orientation.
Params:
Name | Type | Attribute | Description |
orientation | string | The orientation to set the tree to. |
public setParentIdAccessor(newParentIdAccessor: getParentIdCallBack): object source
Sets the parent ID accessor callback function, defining how to get the parent ID from a given data item.
Params:
Name | Type | Attribute | Description |
newParentIdAccessor | getParentIdCallBack | Callback function to get the parent id for a given data item. |
public setTheme(theme: string): object source
Sets the tree theme.
Params:
Name | Type | Attribute | Description |
theme | string | The theme to set the tree to. |
public setWidthWithoutMargins(newWidthWithoutMargin: *): object source
Sets the width of the SVG for the tree diagram.
Params:
Name | Type | Attribute | Description |
newWidthWithoutMargin | * | The width of SVG for the tree diagram. |
public update(nodeDataItem: object): object source
Updates the tree given a D3 tree node.
Params:
Name | Type | Attribute | Description |
nodeDataItem | object | The D3 node data item. |
public updateTreeWithFocusOnNode(nodeDataItem: object): object source
Updates the tree diagram so only the relevant focused node and direct parent hierarchies are shown.
Params:
Name | Type | Attribute | Description |
nodeDataItem | object | D3 Node data item. |
public validateSettings(): object source
Validates the settings to ensure the tree diagram is ready to be generated.
Private Methods
private _addUnderlyingChildNode(parentNodeDataItem: object, dataItem: object): object source
Creates and adds a child D3 tree node to a given parent D3 tree node.
private _createNode(parentNodeDataItem: object, dataItem: object): object source
Creates a child D3 tree node.
private _getLinkPathGenerator(): function source
Gets the path generator used to render the links between the nodes.
Return:
function | The callback function that generates the SVG path coordinates for the links, given a coordinates object. |
private _getNodeSize(): number[] source
Called when updating dimensions when node settings is configured to be 'nodesize'.
Return:
number[] | An array with two values, representing the height and width of the node respectively. |
private _linkEnter(source: *, linkEnter: *, links: *, linkPathGenerator: *): object source
Defines how to create the links for newly added data objects.
Params:
Name | Type | Attribute | Description |
source | * | The original data object that the links are being drawn for. |
|
linkEnter | * | The D3 Enter selection of links. |
|
links | * | ||
linkPathGenerator | * |
private _linkExit(source: object, linkExit: *, linkExitTransition: *, links: *, linkPathGenerator: *): object source
Defines how to remove the links for the removed data objects.
Params:
Name | Type | Attribute | Description |
source | object | The original data object that the links are being drawn for. |
|
linkExit | * | The D3 Exit selection of links. |
|
linkExitTransition | * | The D3 transition object for the D3 Update selection of links. |
|
links | * | ||
linkPathGenerator | * | The link path generator function. |
private _linkUpdate(source: *, linkUpdate: *, linkUpdateTransition: *, links: *, linkPathGenerator: *): object source
Defines how to update the links for the data objects.
Params:
Name | Type | Attribute | Description |
source | * | The original data object that the links are being drawn for. |
|
linkUpdate | * | The D3 Update selection of links. |
|
linkUpdateTransition | * | The D3 transition object for the D3 Update selection of links. |
|
links | * | ||
linkPathGenerator | * | The link path generator function. |
private _nodeEnter(nodeEnter: *, nodes: *): object source
Defines how to create the nodes for newly added data objects.
Params:
Name | Type | Attribute | Description |
nodeEnter | * | The D3 Enter selection of nodes. |
|
nodes | * |
private _nodeExit(nodeExit: *, nodeExitTransition: *, nodes: *): object source
Defines how to remove the nodes for the removed data objects.
Params:
Name | Type | Attribute | Description |
nodeExit | * | The D3 Exit selection of nodes. |
|
nodeExitTransition | * | The D3 transition object for the D3 Exit selection of nodes. |
|
nodes | * |
private _nodeUpdate(nodeUpdate: *, nodeUpdateTransition: *, nodes: *): object source
Defines how to update the nodes for the data objects.
Params:
Name | Type | Attribute | Description |
nodeUpdate | * | The D3 Update selection of nodes. |
|
nodeUpdateTransition | * | The D3 transition object for the D3 Update selection of nodes. |
|
nodes | * |
private _onNodeClick(nodeDataItem: object, index: number, arr: object[]): boolean source
Triggers the nodeClick event when a D3 node is clicked on, and proceeds to focus/expand/collapse the node.
Emit:
Emit node click event. |
private _populateUnderlyingChildren(nodeDataItem: object): object source
Populates the node's children to a hidden property.
Params:
Name | Type | Attribute | Description |
nodeDataItem | object | The D3 node data item to collapse. |
private _processLoadedDataForNodeFocus(nodeDataItem: object, result: object[]): object source
Process the loaded data from AJAX resulting from a node expand.
private _processLoadedDataForNodeToggle(nodeDataItem: object, result: object[]): object source
Process the loaded data from AJAX resulting from a node toggle.