MappersBehavior
- Kind
- class
- Source
- src/behaviors/MappersBehavior.js:90
Description
Built-in behavior for node and edge visual mappers.
Signature
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options | Object | optional | Serializable node/edge mapper snapshots or channel configurations for color, size, opacity, outline, and edge width. |
Returns
Behavior that applies and serializes mapper channel state.
TypeMappersBehaviorNotes
Mapper channel configs should avoid functions when they need to be
persisted. Use serializable constant, linear, categorical,
colormap, nodeToEdge, and passthrough configurations.
Instance Properties
id
Source: src/behaviors/MappersBehavior.js:91
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/MappersBehavior.js:207
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/MappersBehavior.js:99
Configures or reads attach.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
context | Value passed to attach. |
serialize()
Source: src/behaviors/MappersBehavior.js:127
Handles serialize for the current graph or visualization state.
restore(snapshot = {}) → {this}
Source: src/behaviors/MappersBehavior.js:194
Updates the restore state on the current instance.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
snapshot | optional | {} | Value passed to restore. |
Returns
This instance.
TypethisMappers
Mapper configuration for node and edge visual channels. MappersBehavior handles mapper UI state.
mappers(options) → {Object|this}
Source: src/behaviors/MappersBehavior.js:211
Read or set the mappers setting.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options | Object | Options object for this operation. |
Returns
Current mappers value when called without arguments; otherwise this instance for chaining.
TypeObject|thisExample
helios.mappers({
enabled: true,
});
Configuration
General configuration setters and compatibility helpers.
getChannelConfig(mode, channel)
Source: src/behaviors/MappersBehavior.js:216
Returns the current channel config value or state.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
mode | string | Mode for this operation. | ||
channel | string | Channel for this operation. |
Example
helios.getChannelConfig('2d');
setModeSnapshot(mode, snapshot, { reason = 'mode', trackOverride = true } = {}) → {this}
Source: src/behaviors/MappersBehavior.js:300
Set the mode snapshot setting.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
mode | string | Mode for this operation. | ||
snapshot | Value passed to setModeSnapshot. | |||
reason | string | optional | 'mode' | Reason for this operation. |
trackOverride | optional | true } = {} | Value passed to setModeSnapshot. |
Returns
This instance.
TypethisExample
helios.setModeSnapshot('2d');
Utilities
Additional public helpers that do not belong to a narrower API area.
update(options = {}) → {Object|this}
Source: src/behaviors/MappersBehavior.js:117
Read or set the update setting.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options | Object | optional | {} | Options object for this operation. |
Returns
Current update value when called without arguments; otherwise this instance for chaining.
TypeObject|thisExample
helios.update({
enabled: true,
});
stateEntries()
Source: src/behaviors/MappersBehavior.js:133
Configures or reads state entries.
emitChange(reason, detail = {})
Source: src/behaviors/MappersBehavior.js:203
Configures or reads emit change.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
reason | string | Reason for this operation. | ||
detail | optional | {} | Event payload passed to listeners. |
replaceDefaultChannels(mode, channels = {}, { reason = 'channels', trackOverride = true } = {})
Source: src/behaviors/MappersBehavior.js:278
Updates the default channels state on the current instance.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
mode | string | Mode for this operation. | ||
channels | optional | {} | Value passed to replaceDefaultChannels. | |
reason | string | optional | 'channels' | Reason for this operation. |
trackOverride | optional | true } = {} | Value passed to replaceDefaultChannels. |
Example
helios.replaceDefaultChannels('2d');
syncFromHelios({ silent = false } = {})
Source: src/behaviors/MappersBehavior.js:314
Configures or reads sync from helios.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
silent | optional | false } = {} | Value passed to syncFromHelios. |
Mapper Configuration
getSerializedChannelConfig(mode, channel) → {Object|null}
Source: src/behaviors/MappersBehavior.js:234
Return a serializable snapshot for one visual channel.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
mode | 'node'|'edge' | Mapper collection to inspect. | ||
channel | string | Visual channel name such as color, size, opacity, outline, or width. |
Returns
JSON-safe channel configuration, or null when the channel is not registered.
Object|nullExample
helios.getSerializedChannelConfig('2d');
setChannelConfig(mode, channel, config, options = {}) → {boolean}
Source: src/behaviors/MappersBehavior.js:257
Replace the default mapper configuration for one visual channel.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
mode | 'node'|'edge' | Mapper collection to update. | ||
channel | string | Visual channel name. | ||
config | Object | Serializable channel configuration. | ||
options | Object | optional | {} | Options object for this operation. |
Returns
true when the channel was applied.
booleanNotes
This mutates the active default mapper and emits a mapper change event. Persisted configurations should avoid functions.
Example
helios.behavior.mappers.setChannelConfig('node', 'color', {
type: 'colormap',
attributes: 'score',
colormap: 'interpolateViridis',
domain: [0, 1],
});