Search

Combos

Combos can be used to combine nodes and links together to simplify the visualisation. To access the combo namespace, use chart.combo().

Arranges the items inside a combo.

Items are arranged automatically (default) or manually. The available automatic options are:

  • lens - automatic arrangement with connected nodes next to each other. The default for circular combos.
  • concentric - circular arrangement with larger items at the centre.
  • grid - grid arrangement running from left to right, from the top down in the order in which they are added in the combo. The default for rectangular combos.
  • sequential - tree-like arrangement showing the sequence of links between distinct levels of nodes.

To stop items from being arranged automatically, set name to 'none'.

Multiple ids can be passed to the arrange() function: in this case, items inside open combos within the array will be arranged.

Return Object

Use the returned promise to know when the operation is complete.

Note: You must wait for the combine promise to be fulfilled before performing another chart function.

Parameters

id
required
string | string[]

The ids of the combos to be arranged.

Options controlling the operation.

"all" | "inCombo" | "none" default: 'all'

Controls how items (nodes and combos) outside the specified combo push away / pull towards the combo that changed during arrange. This applies to items at the top chart level positioned by layout, and also to items contained in the hierarchy of one or more parent combo(s) of the specified combo. Note that if the parent combo's arrangement is set to 'grid', it always adapts.

  • 'all': All items adapt.
  • 'inCombo': Items within the parent combo(s) adapt, items at the top chart level stay unchanged.
  • 'none': No items adapt.
boolean default: true

Whether the operation should be animated.

"auto" | object default: 'auto'

When name is set to 'grid', controls the row/column dimension of the grid. Specify an object in the form { rows: number } or { columns: number }.

string

When layout name is set to 'sequential', the name of the custom property on the node's or combo node's d property that defines which level the node/combo belongs to. The property must contain a numeric value, where the lowest value node is placed at the top of the hierarchy. Levels for nodes with no level data are inferred from the nodes' links.

"direct" | "curved" | "angled" default: 'direct'

The shape of the path taken by links.

  • 'direct' - links are either straight or follow arcs when offset.
  • 'curved' - link follow a curved path, and attach to nodes in the direction of orientation.
  • 'angled' - links follow straight lines with corners: useful for hierarchical data sets. Currently in beta.

The direction of 'curved' and 'angled' links is inferred from orientation.

"lens" | "concentric" | "grid" | "sequential" | "none" default: 'lens' / 'grid'

Controls how nodes are arranged inside an open combo.

  • 'lens' - automatic arrangement with connected nodes next to each other. The default for circular combos.
  • 'concentric' - circlular arrangement with larger items at the centre.
  • 'grid' - grid arrangement running from left to right, from the top down in the order in which they are added in the combo. The default for rectangular combos.
  • 'sequential' - tree-like arrangement showing the sequence of links between distinct levels of nodes.
  • 'none' - items are kept in their original positions.
string | OrderByOptions

When the arrangement name is 'sequential', specifies the order of nodes/combos within the same arrangement level of a connected component in the chart. Any disconnected nodes or combos are ignored.

string

The key of the custom data value on the node's d property used to order nodes alphanumerically within each level. When specified, nodes are ordered alphanumerically, in descending order, unless sortBy is also set.

"ascending" | "descending" default: 'descending'

The direction of ordering.

"left" | "right" | "up" | "down" default: 'down'

When name is set to 'sequential', the orientation of the arrangement.

"none" | "circle" | "rectangle" | "adaptive" | "aligned" default: 'aligned'

When name is set to 'sequential', the packing mode to use.

boolean default: true

If true, the open combos will be resized to fit their contents. If false, they will not be resized.

"auto" | "equal" | "stretched" default: 'auto'

When name is set to 'sequential', the spacing between nodes at each level.

StackOptions

When name is set to 'sequential', stacking options for nodes sharing the same neighbours and level. If property is set in orderBy, stacking is only applied to nodes sharing the same property value.

arrange

required
"none" | "grid" default: 'none'

If set to 'grid', four or more same-level nodes with identical neighbours are stacked in a grid.

boolean default: true

By default, links are drawn ignoring off. If false, link offsets are preserved.

number default: 1

When name is set to 'sequential', the spacing between levels. Values must be positive.

"auto" | "equal" default: 'equal'

The type of spacing between levels in sequential layout. Set to 'auto' if individual levels contain unevenly sized items (nodes or combos) to optimise use of space and get more even distribution of levels.

number default: 5

Controls how close items are to each other in open combos. Must be in the range 0 to 10, with higher values being closer.

number default: 250

If animated, the time the animation should take, in milliseconds.

string | string[]

When name is set to 'sequential', and level isn't set, specifies the node(s) in the top level of the arrangement. Nodes without top specified are unchanged during the layout but but may be repositioned by packing.

Returns Promise

A Promise. You must wait for the promise to be fulfilled before performing another chart function.

Closes the specified open combo/s, concealing the items inside.

Parameters

ids
required
string | string[]

The ids of the combos to be closed.

Options controlling the operation.

"all" | "inCombo" | "none" default: 'all'

Controls how items (nodes and combos) outside the specified combo push away / pull towards the opening or closing combo. This applies to items at the top chart level positioned by layout, and also to items contained in the hierarchy of one or more parent combo(s) of the specified combo. Note that if the parent combo's arrangement is set to 'grid', it always adapts.

  • 'all': All items adapt.
  • 'inCombo': Items within the parent combo(s) adapt, items at the top chart level stay unchanged.
  • 'none': No items adapt.
boolean default: true

Whether the operation should be animated.

number default: 250

If animated, the time the animation should take, in milliseconds.

Returns Promise

A Promise. You must wait for the promise to be fulfilled before performing another chart function.

Combines a number of nodes into one or more 'combo nodes'. A combo definition object defines which nodes should be included in these combos and how they should be displayed.

A combo can be created in one of two states:

  • closed (default) - items inside the combo are not visible.
  • open - items inside the combo are displayed inside a combo border on the chart.

To open a combo, set the open property on its definition object.

Any links that connect nodes outside the combo to nodes inside it are combined into 'combo links'.

Return Object

Use the returned promise to detect when the operation has completed. The fulfilled promise returns an array of the identities of the combo nodes created as the first argument.

Note: You must wait for the combine promise to be fulfilled before performing another chart function.

chart.combo().combine({ ids: [id1, id2] }).then((comboIds) => {
  // do more after combine
});

To create many combos at once, use an array of combo definitions.

chart.combo().combine(
  [{ ids: [id1, id2] }, { ids: [id3, id4] }]).then((comboIds) => {
  // do more after combine
});

You cannot combine items that already exist inside a combo.

Closed and open combo states should not be confused with hide() and show() chart functions. If you combine a mixture of hidden and shown nodes, the nodes inside the combo will remain hidden or shown as appropriate. If you combine only hidden nodes, the combo itself will be hidden.

Parameters

A definition of the combo/s to create.

any

If defined, all properties will be transferred to the new combo's d property.

number default: 0

An x offset for positions of members of the combo if it is later uncombined.

number default: 0

A y offset for positions of members of the combo if it is later uncombined.

null | Glyph

The style of the counter glyph showing the number of nodes inside the closed combo. The default counter glyph is red and is located in the top right corner. Set to null to disable counter glyphs.

ids

required
string[]

The ids of nodes to combine. This can contain one or more node ids.

string

The default combo label if no label is set in the style or openStyle properties.

boolean default: false

Whether the combo should be created in the open state.

The style of the open combo node. If not set, the style is inherited from the openCombos setting of defaultStyles.

string(Colour) default: 'grey'

The border colour.

number | string | number[] | object default: '0 0 0 0'

The corner radius. Accepts a number to set radius to all corners, a string of space-separated numbers ( top left, top right, bottom right, bottom left), an array of comma-separated numbers, or an object setting values for properties such as topLeft or bottomRight.

"solid" | "dashed" default: 'solid'

The style of the border line.

number default: 1

The border width.

string default: 'light grey'

The background colour of the open combo.

Beta
Glyph[]

An array of objects describing the glyphs shown on the open combo.

number

The height of the open rectangular combo. Set to fit all content when the combo is created.

boolean default: false

Whether resize handles are shown on open combos.

string | NodeLabel | NodeLabel[]
  • string - A simple text string label.
  • Beta NodeLabel - A single label object that can contain label styling properties.
  • Beta NodeLabel[] - An array of objects to add multiple labels where each label can be styled individually.

For more details about label styling see the Advanced combo styling documentation.

number

The width of the open combo. This is automatically set to fit all content when the combo is created. Set this option after the combo has been created.

"average" | "first" default: 'average'

The chart position of the final combo.

  • 'average': use the average position of the nodes to centre the arrangement.
  • 'first': use the position of the first node in the ids array.

The style of the closed combo node. If not set, the style is inherited from the first node in the ids array except for the t option. If hi is not set, the combo is visible if any of its member nodes are visible. Setting parentId in style is not supported.

Options controlling the operation.

boolean default: true

Whether the combination(s) should be animated.

string | ComboArrangeOptions default: 'lens' / 'grid'

Controls the arrangement of nodes inside an open combo. Can be set directly to any value from the name property, or to an object that sets a name and any properties associated with that arrangement.

boolean default: true

Whether the combo(s) should be selected.

number default: 250

If animated, the time the animation should take, in milliseconds.

Returns Promise

A Promise. You must wait for the promise to be fulfilled before performing another chart function.

Finds the ids of the combos that contain the given nodes, links or child combos.

Parameters

ids
required
string | string[]

The ids of the nodes, links or combos whose parents should be found.

Options controlling how the find operates.

"top" | "first" default: 'top'

Specifies where to look for a parent of an item. There's a parent-child relationship between a combo and the items it contains.

  • 'first': finds the immediate parent of the item.
  • 'top': finds the parent at the top of the nested combo hierarchy.

Returns string | null | (string | null)[]

The ids of the combos containing the given items, or null if not found.

Finds every underlying node and link inside a combo or nest of combos, or null if the id is not a combo.

Parameters

id
required
string

The id of the combo.

Returns object | null

An object in the form:

{
  links:[link1, link2, ..],
  nodes:[node1, node2, ..]
}

Tests node or link ids to find out whether they are combo nodes or combo links. If a list of ids is used, it returns true if any of the items are combos.

The options argument defines which items to test. For example, to test whether a selection contains a combo node:

const selectionContainsNodeCombo = chart.combo().isCombo(chart.selection(), { type: 'node' });

Parameters

id
required
string | string[]

The id/s of the items to be tested.

Options controlling whether links or nodes are tested.

"link" | "all" | "node" default: 'all'

Specifies which types of item are tested.

Returns boolean

True if any of the node or link id is a combo, false otherwise.

Tests whether an item is an open combo.

Parameters

id
required
string

The id of the item to be tested.

Returns boolean

True if the item id is an open combo, false otherwise.

Opens the specified combo/s so the contents are visible inside a combo border on the chart. To change the border style, set the openStyle options of chart.combo().combine.

Parameters

ids
required
string | string[]

The id/s of the combos to be opened.

Options controlling the open operation.

"all" | "inCombo" | "none" default: 'all'

Controls how items (nodes and combos) outside the specified combo push away / pull towards the opening or closing combo. This applies to items at the top chart level positioned by layout, and also to items contained in the hierarchy of one or more parent combo(s) of the specified combo. Note that if the parent combo's arrangement is set to 'grid', it always adapts.

  • 'all': All items adapt.
  • 'inCombo': Items within the parent combo(s) adapt, items at the top chart level stay unchanged.
  • 'none': No items adapt.
boolean default: true

Whether the operation should be animated.

number default: 250

If animated, the time the animation should take, in milliseconds.

Returns Promise

A Promise. You must wait for the promise to be fulfilled before performing another chart function.

Gets or sets the list of revealed links.

Links which connect nodes inside a combo to nodes outside it are normally combined into a single link to reduce clutter. The reveal() function shows the original underlying links.

Calling reveal() with a parameter replaces the previous list of revealed links. Pass an empty array to clear all revealed links.

Parameters

string | string[]

The id/s of the links to be revealed.

Returns string[]

The currently revealed links.

Transfers the specified items into or out of a combo, increasing the size of the target combo as needed to fit its new contents.

Parameters

id
required
string | string[]

The id/s of nodes to be transferred into or out of a combo.

comboId
required
null | string

The id of the combo to transfer the items to, or null to transfer items out of the combo and onto the chart.

Options controlling the transfer operation.

"all" | "inCombo" | "none" default: 'all'

Controls how items (nodes and combos) outside the specified combo push away / pull towards the combo that changed during transfer. This applies to items at the top chart level positioned by layout, and also to items contained in the hierarchy of one or more parent combo(s) of the specified combo. Note that if the parent combo's arrangement is set to 'grid', it always adapts.

  • 'all': All items adapt.
  • 'inCombo': Items within the parent combo(s) adapt, items at the top chart level stay unchanged.
  • 'none': No items adapt.
boolean default: true

Whether the transfer operation should be animated.

string | ComboArrangeOptions default: 'lens' / 'grid'

Controls the arrangement of nodes inside an open combo. Can be set directly to any value from the name property, or to an object that sets a name and any properties associated with that arrangement.

boolean default: true

Controls whether the open combo is reduced in size to fit if some contents have been removed or it's been arranged more densely. If true, the combo's size is decreased to fit. If false, its size is not reduced.

number default: 250

If animated, the time the animation should take, in milliseconds.

Returns Promise

A Promise. You must wait for the promise to be fulfilled before performing another chart function.

Uncombines the specified combo nodes. Items inside the combo(s) are displayed on the chart. Combo links that connect nodes inside the combo to nodes outside it are also uncombined.

When nodes are uncombined, their original position is used to place them in the same shape relative to the uncombined node.

Multiple ids can be passed to the uncombine() function: in this case, all combo nodes in the array will be uncombined.

You cannot uncombine nested items (combo nodes and combo links that exist inside other combos).

Return Object

Use the returned promise to know when the operation is complete.

Note: You must wait for the combine promise to be fulfilled before performing another chart function.

Parameters

id
required
string | string[]

The id/s of the combos to be uncombined.

Options controlling the uncombine operation.

boolean default: true

Whether the operation should be animated.

boolean default: false

Whether all nodes inside the combo (including nodes inside nested combos) should be uncombined. If false, only the first level of the combo is uncombined.

boolean default: true

Whether the uncombined nodes should be selected.

number default: 250

If animated, the time the animation should take, in milliseconds.

Returns Promise

A Promise. You must wait for the promise to be fulfilled before performing another chart function.

Terms of use

These terms do not alter or supersede any existing agreements between you (or your employer) and us.

By accessing or using any Content you agree to be bound by these Terms of Use. Please review these terms carefully before using the website.

The contents of this website, including but not limited to any text, code samples, API references, schemas, interactive tools, and other materials (collectively, the 'Content'), are made available for informational and internal evaluation purposes only. All intellectual property rights in the Content are reserved. No licence is granted to use the Content for any commercial purpose, or to copy, distribute, modify, reverse-engineer, or incorporate any part of the Content into any product or service, without our prior written consent.

This Content is provided “as is” and “as available,” without any representations, warranties, or guarantees of any kind, whether express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, non-infringement, or accuracy. To the fullest extent permitted by applicable law, we expressly exclude and disclaim all implied warranties, conditions, and other terms that might otherwise be implied.

We disclaim all liability for any loss or damage, whether direct, indirect, incidental, consequential, or otherwise, arising from any reliance placed on the Content or from your use of it, to the fullest extent permitted by applicable law. By continuing to access or use the Content, you acknowledge and agree to these terms.