Home Reference Source
import CircleTree from 'd3-mitch-tree/js/CircleTree.js'
public class | source

CircleTree

Extends:

events~EventEmitterBaseTree → CircleTree

Constructor Summary

Public Constructor
public

constructor(options: object)

Member Summary

Public Members
public
Private Members
private

Method Summary

Public Methods
public

getDisplayText(nodeDataItem: object): string

Gets the display text for a given data item.

public

initialize(): *

public

setDisplayTextAccessor(newDisplayTextAccessor: displayTextAccessorCallBack): *

Sets the display text accessor, used to get the display text for the nodes.

public
Private Methods
private
private
private

_linkEnter(source: *, linkEnter: *, links: *, linkPathGenerator: *): *

private

_linkExit(source: *, linkExit: *, linkExitTransition: *, links: *, linkPathGenerator: *): *

private

_linkUpdate(source: *, linkUpdate: *, linkUpdateTransition: *, links: *, linkPathGenerator: *): *

private

_nodeEnter(nodeEnter: *, nodes: *): *

private

_nodeExit(nodeExit: *, nodeExitTransition: *, nodes: *): *

private

_nodeUpdate(nodeUpdate: *, nodeUpdateTransition: *, nodes: *): *

Inherited Summary

From class BaseTree
public
public
private
private
private
private
private

_data: *

private
private
private
private

_getId: *

private
private
private
private
private

_links: *

private
private
private
private
private
private
private
private

_root: *

private

_svg: *

private

_theme: *

private
private

_view: *

private
private
private
public

centerNode(nodeDataItem: *): object

Center the view to a D3 tree node.

public

collapse(nodeDataItem: object): object

Collapses the given node data item.

public

Collapses the given node data item, and its children and descendants.

public

expand(nodeDataItem: object): object

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

Get a single data item given an id.

public

Gets the duration of animations for the tree.

public

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

getId(dataItem: object): *

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

Gets the margins for the tree diagram.

public

Gets the maximum zoom scaling.

public

Gets the minimum zoom scaling.

public

getNode(idOrDataItem: * | object): object

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

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

Creates and set up the the tree diagram.

public

nodeFocus(nodeDataItem: object): object

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

setData(newData: object[]): object

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

update(nodeDataItem: object): object

Updates the tree given a D3 tree node.

public

Updates the dimensions of the SVG.

public

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

_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

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

_nodeExit(nodeExit: *, nodeExitTransition: *, nodes: *): object

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

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

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

Override:

BaseTree#constructor

Params:

NameTypeAttributeDescription
options object
  • optional

The options object.

options.getDisplayText displayTextAccessorCallBack
  • optional

Determines how to obtain the text to display for a node corresponding to a data item.

Public Members

public nodeSettings: * source

Override:

BaseTree#nodeSettings

Private Members

private _getDisplayText: * source

Public Methods

public getDisplayText(nodeDataItem: object): string source

Gets the display text for a given data item.

Params:

NameTypeAttributeDescription
nodeDataItem object

The data item to get the display text from.

Return:

string

The display text to render for the node.

public initialize(): * source

Creates and set up the the tree diagram.

Override:

BaseTree#initialize

Return:

*

public setDisplayTextAccessor(newDisplayTextAccessor: displayTextAccessorCallBack): * source

Sets the display text accessor, used to get the display text for the nodes.

Params:

NameTypeAttributeDescription
newDisplayTextAccessor displayTextAccessorCallBack

Return:

*

public validateSettings(): * source

Validates the settings to ensure the tree diagram is ready to be generated.

Override:

BaseTree#validateSettings

Return:

*

Private Methods

private _getLinkPathGenerator(): * source

Gets the path generator used to render the links between the nodes.

Override:

BaseTree#_getLinkPathGenerator

Return:

*

private _getNodeSize(): undefined[] source

Called when updating dimensions when node settings is configured to be 'nodesize'.

Override:

BaseTree#_getNodeSize

Return:

undefined[]

private _linkEnter(source: *, linkEnter: *, links: *, linkPathGenerator: *): * source

Defines how to create the links for newly added data objects.

Override:

BaseTree#_linkEnter

Params:

NameTypeAttributeDescription
source *
linkEnter *
links *
linkPathGenerator *

Return:

*

private _linkExit(source: *, linkExit: *, linkExitTransition: *, links: *, linkPathGenerator: *): * source

Defines how to remove the links for the removed data objects.

Override:

BaseTree#_linkExit

Params:

NameTypeAttributeDescription
source *
linkExit *
linkExitTransition *
links *
linkPathGenerator *

Return:

*

private _linkUpdate(source: *, linkUpdate: *, linkUpdateTransition: *, links: *, linkPathGenerator: *): * source

Defines how to update the links for the data objects.

Override:

BaseTree#_linkUpdate

Params:

NameTypeAttributeDescription
source *
linkUpdate *
linkUpdateTransition *
links *
linkPathGenerator *

Return:

*

private _nodeEnter(nodeEnter: *, nodes: *): * source

Defines how to create the nodes for newly added data objects.

Override:

BaseTree#_nodeEnter

Params:

NameTypeAttributeDescription
nodeEnter *
nodes *

Return:

*

private _nodeExit(nodeExit: *, nodeExitTransition: *, nodes: *): * source

Defines how to remove the nodes for the removed data objects.

Override:

BaseTree#_nodeExit

Params:

NameTypeAttributeDescription
nodeExit *
nodeExitTransition *
nodes *

Return:

*

private _nodeUpdate(nodeUpdate: *, nodeUpdateTransition: *, nodes: *): * source

Defines how to update the nodes for the data objects.

Override:

BaseTree#_nodeUpdate

Params:

NameTypeAttributeDescription
nodeUpdate *
nodeUpdateTransition *
nodes *

Return:

*