Skip to content

LabelsBehavior

class

Back to Helios Web API

Kind
class
Source
src/behaviors/LabelsBehavior.js:108

Description

Built-in behavior for SVG label overlays.

Signature

export class LabelsBehavior extends Behavior {

Parameters

NameTypeAttributesDefaultDescription
optionsObjectoptionalLabel options including enabled, source, selectionMode, maxVisible, collision settings, font settings, and export compatibility flags.

Returns

Behavior controlling the live label overlay.

Type LabelsBehavior

Notes

Labels can be driven by a node attribute, callback, selection state, hover state, and screen-space collision/ranking limits.

Instance Properties

id

Source: src/behaviors/LabelsBehavior.js:109

Id exposed by the class.

Filtering And State

Graph filtering and interaction state. When active, FilterBehavior and SelectionBehavior coordinate this area.

getPublicState()

Source: src/behaviors/LabelsBehavior.js:351

Returns the current public state value or state.

Example


const value = helios.getPublicState();

Network And Persistence

Network replacement, serialization, and visualization state persistence. ExporterBehavior and InterfaceBehavior can surface parts of this flow in the UI.

attach(context)

Source: src/behaviors/LabelsBehavior.js:123

Configures or reads attach.

Parameters

NameTypeAttributesDefaultDescription
contextValue passed to attach.

serialize()

Source: src/behaviors/LabelsBehavior.js:153

Handles serialize for the current graph or visualization state.

restore(snapshot = {}) → {this}

Source: src/behaviors/LabelsBehavior.js:344

Updates the restore state on the current instance.

Parameters

NameTypeAttributesDefaultDescription
snapshotoptional{}Value passed to restore.

Returns

This instance.

Type this

Camera And View

Camera framing, target following, dimensional mode, and transitions. InterfaceBehavior can expose these controls.

mode(value, options = {})

Source: src/behaviors/LabelsBehavior.js:385

Configures or reads mode.

Parameters

NameTypeAttributesDefaultDescription
valuestringNew mode value. Omit this argument to read the current value.
optionsObjectoptional{}Options object for this operation.

Example


helios.mode('auto');

Appearance

Visual rendering settings for nodes, edges, labels, legends, density, shading, and background. AppearanceBehavior, LabelsBehavior, and LegendsBehavior cover the built-in controls.

fontSizeScale(value) → {number|this}

Source: src/behaviors/LabelsBehavior.js:408

Read or set the font size scale setting.

Parameters

NameTypeAttributesDefaultDescription
valuenumberNew font size scale value. Omit this argument to read the current value.

Returns

Current font size scale value when called without arguments; otherwise this instance for chaining.

Type number|this

Example


helios.fontSizeScale(1);

outlineWidth(value) → {number|this}

Source: src/behaviors/LabelsBehavior.js:422

Read or set the outline width setting.

Parameters

NameTypeAttributesDefaultDescription
valuenumberNew outline width value. Omit this argument to read the current value.

Returns

Current outline width value when called without arguments; otherwise this instance for chaining.

Type number|this

Example


helios.outlineWidth(1);

outlineColor(value) → {string|Array<number>|this}

Source: src/behaviors/LabelsBehavior.js:462

Read or set the outline color setting.

Parameters

NameTypeAttributesDefaultDescription
valuestring|Array<number>New outline color value. Omit this argument to read the current value.

Returns

Current outline color value when called without arguments; otherwise this instance for chaining.

Type string|Array<number>|this

Example


helios.outlineColor('#4aa3ff');

Configuration

General configuration setters and compatibility helpers.

setHoverPolicy({ enabled = false, source = null } = {}) → {this}

Source: src/behaviors/LabelsBehavior.js:487

Set the hover policy setting.

Parameters

NameTypeAttributesDefaultDescription
enabledoptionalfalseValue passed to setHoverPolicy.
sourceBlob|ArrayBuffer|string|Fileoptionalnull } = {}Network or input source used by the operation.

Returns

This instance.

Type this

clearHoverPolicy(options = {}) → {Object|this}

Source: src/behaviors/LabelsBehavior.js:497

Read or set the clear hover policy setting.

Parameters

NameTypeAttributesDefaultDescription
optionsObjectoptional{}Options object for this operation.

Returns

Current clear hover policy value when called without arguments; otherwise this instance for chaining.

Type Object|this

Example


helios.clearHoverPolicy({
  enabled: true,
});

Utilities

Additional public helpers that do not belong to a narrower API area.

update(options = {}, changeOptions = {})

Source: src/behaviors/LabelsBehavior.js:135

Configures or reads update.

Parameters

NameTypeAttributesDefaultDescription
optionsObjectoptional{}Options object for this operation.
changeOptionsoptional{}Value passed to update.

Example


helios.update({
  enabled: true,
});

stateEntries()

Source: src/behaviors/LabelsBehavior.js:159

Configures or reads state entries.

emitChange(reason, detail = {})

Source: src/behaviors/LabelsBehavior.js:360

Configures or reads emit change.

Parameters

NameTypeAttributesDefaultDescription
reasonstringReason for this operation.
detailoptional{}Event payload passed to listeners.

labels(options) → {Object|this}

Source: src/behaviors/LabelsBehavior.js:364

Read or set the labels setting.

Parameters

NameTypeAttributesDefaultDescription
optionsObjectOptions object for this operation.

Returns

Current labels value when called without arguments; otherwise this instance for chaining.

Type Object|this

Example


helios.labels({
  enabled: true,
});

enabled(value, options = {}) → {this}

Source: src/behaviors/LabelsBehavior.js:380

Configures or reads enabled.

Parameters

NameTypeAttributesDefaultDescription
valuebooleanNew enabled value. Omit this argument to read the current value.
optionsObjectoptional{}Options object for this operation.

Returns

This instance.

Type this

Example


helios.enabled(true);

selectedOnlySpaceAware(value) → {Object|this}

Source: src/behaviors/LabelsBehavior.js:398

Read or set the selected only space aware setting.

Parameters

NameTypeAttributesDefaultDescription
valueNew selected only space aware value. Omit this argument to read the current value.

Returns

Current selected only space aware value when called without arguments; otherwise this instance for chaining.

Type Object|this

Example


helios.selectedOnlySpaceAware(1);

maxVisible(value) → {number|this}

Source: src/behaviors/LabelsBehavior.js:403

Read or set the max visible setting.

Parameters

NameTypeAttributesDefaultDescription
valuenumberNew max visible value. Omit this argument to read the current value.

Returns

Current max visible value when called without arguments; otherwise this instance for chaining.

Type number|this

Example


helios.maxVisible(1);

minScreenRadius(value) → {number|this}

Source: src/behaviors/LabelsBehavior.js:415

Read or set the min screen radius setting.

Parameters

NameTypeAttributesDefaultDescription
valuenumberNew min screen radius value. Omit this argument to read the current value.

Returns

Current min screen radius value when called without arguments; otherwise this instance for chaining.

Type number|this

Example


helios.minScreenRadius(1);

offsetRadiusFactor(value) → {number|this}

Source: src/behaviors/LabelsBehavior.js:429

Read or set the offset radius factor setting.

Parameters

NameTypeAttributesDefaultDescription
valuenumberNew offset radius factor value. Omit this argument to read the current value.

Returns

Current offset radius factor value when called without arguments; otherwise this instance for chaining.

Type number|this

Example


helios.offsetRadiusFactor(1);

offsetPx(value) → {Object|this}

Source: src/behaviors/LabelsBehavior.js:436

Read or set the offset px setting.

Parameters

NameTypeAttributesDefaultDescription
valueNew offset px value. Omit this argument to read the current value.

Returns

Current offset px value when called without arguments; otherwise this instance for chaining.

Type Object|this

Example


helios.offsetPx(1);

maxChars(value) → {number|this}

Source: src/behaviors/LabelsBehavior.js:443

Read or set the max chars setting.

Parameters

NameTypeAttributesDefaultDescription
valuenumberNew max chars value. Omit this argument to read the current value.

Returns

Current max chars value when called without arguments; otherwise this instance for chaining.

Type number|this

Example


helios.maxChars(1);

maxRows(value) → {number|this}

Source: src/behaviors/LabelsBehavior.js:450

Read or set the max rows setting.

Parameters

NameTypeAttributesDefaultDescription
valuenumberNew max rows value. Omit this argument to read the current value.

Returns

Current max rows value when called without arguments; otherwise this instance for chaining.

Type number|this

Example


helios.maxRows(1);

fill(value) → {Object|this}

Source: src/behaviors/LabelsBehavior.js:457

Read or set the fill setting.

Parameters

NameTypeAttributesDefaultDescription
valueNew fill value. Omit this argument to read the current value.

Returns

Current fill value when called without arguments; otherwise this instance for chaining.

Type Object|this

Example


helios.fill(1);

fontFamily(value) → {string|this}

Source: src/behaviors/LabelsBehavior.js:467

Read or set the font family setting.

Parameters

NameTypeAttributesDefaultDescription
valuestringNew font family value. Omit this argument to read the current value.

Returns

Current font family value when called without arguments; otherwise this instance for chaining.

Type string|this

Example


helios.fontFamily('auto');

source(value) → {string|this}

Source: src/behaviors/LabelsBehavior.js:472

Read or set the source setting.

Parameters

NameTypeAttributesDefaultDescription
valuestringNew source value. Omit this argument to read the current value.

Returns

Current source value when called without arguments; otherwise this instance for chaining.

Type string|this

Example


helios.source('auto');

applySelectionDefaults()

Source: src/behaviors/LabelsBehavior.js:479

Updates the selection defaults state on the current instance.

applyConfig({ silent = false } = {})

Source: src/behaviors/LabelsBehavior.js:504

Updates the config state on the current instance.

Parameters

NameTypeAttributesDefaultDescription
silentoptionalfalse } = {}Value passed to applyConfig.

Example

helios.behavior.labels.update({
  enabled: true,
  source: 'label',
  selectionMode: 'ranked',
  maxVisible: 80,
});