Skip to main content

Class: MarkerDataUtils

Defined in: utils/data/MarkerDataUtils.ts:18

Extends

  • DataUtilsBase

Constructors

Constructor

new MarkerDataUtils(): MarkerDataUtils

Returns

MarkerDataUtils

Inherited from

DataUtilsBase.constructor

Methods

createUniformMarkerData()

static createUniformMarkerData(n, marker, options?): Uint8Array

Defined in: utils/data/MarkerDataUtils.ts:216

Creates a marker data buffer of the given size filled with a single marker.

Parameters

n

number

Number of elements

marker

Marker

The marker to fill with

options?

Optional buffer alignment

align?

number

Returns

Uint8Array

A Uint8Array filled with the encoded marker


encodeMarker()

static encodeMarker(marker): number

Defined in: utils/data/MarkerDataUtils.ts:248

Encodes a Marker into its numeric representation.

Parameters

marker

Marker

The marker to encode

Returns

number

The marker index as a number


fillDataFromTableGroups()

protected static fillDataFromTableGroups<TValue>(data, ids, column, defaultValue, loadTable, mapGroupToValue, encodeValue, options?): Promise<void>

Defined in: utils/data/DataUtilsBase.ts:84

Fills data by loading group keys from the configured table column and mapping them to values.

For each ID in ids, the corresponding row is looked up in the loaded table by ID. The raw cell value is JSON-stringified to produce a group key, which is then mapped to a value using mapGroupToValue. If the mapping fails, defaultValue is used instead.

Type Parameters

TValue

TValue

Parameters

data

TypedArray

Output typed array to fill

ids

number[]

Ordered list of item IDs

column

string

Name of the table column to load group keys from

defaultValue

TValue

Value used when the ID is missing or the group is unmapped

loadTable

(options?) => Promise<TableData>

Async function that loads the TableData

mapGroupToValue

(group) => TValue | undefined

Maps a JSON-stringified group key to TValue, or undefined

encodeValue

(value) => number

Converts TValue to the numeric representation stored in data

options?

Optional abort signal

signal?

AbortSignal

Returns

Promise<void>

Inherited from

DataUtilsBase.fillDataFromTableGroups


fillDataFromTableValues()

protected static fillDataFromTableValues<TValue>(data, ids, column, defaultValue, loadTable, parseTableValue, encodeValue, options?): Promise<void>

Defined in: utils/data/DataUtilsBase.ts:21

Fills data by loading values from the configured table column

For each ID in ids, the corresponding row is looked up in the loaded table by ID. The raw cell value is parsed by parseTableValue; if parsing fails, defaultValue is used instead.

Type Parameters

TValue

TValue

Parameters

data

TypedArray

Output typed array to fill

ids

number[]

Ordered list of item IDs

column

string

Name of the table column to load values from

defaultValue

TValue

Value used when the ID is missing or parsing fails

loadTable

(options?) => Promise<TableData>

Async function that loads the TableData

parseTableValue

(value, valueRange) => TValue | undefined

Converts a raw cell value to TValue, or undefined on failure

encodeValue

(value) => number

Converts TValue to the numeric representation stored in data

options?

Optional abort signal

signal?

AbortSignal

Returns

Promise<void>

Inherited from

DataUtilsBase.fillDataFromTableValues


loadMarkerData()

static loadMarkerData(ids, config, markerMaps, defaultMarker, loadTable, options?): Promise<Uint8Array<ArrayBufferLike>>

Defined in: utils/data/MarkerDataUtils.ts:33

Loads marker data for a set of IDs based on the active marker configuration source.

Dispatches to the appropriate loader (constant, from, or groupBy) depending on which configuration source is active.

Parameters

ids

number[]

Ordered list of item IDs

config

MarkerConfig

Marker configuration specifying the data source

markerMaps

DefaultMap<Marker>[]

Available marker maps for groupBy lookups

defaultMarker

Marker

Fallback marker when no valid config or value is found

loadTable

(tableId, options?) => Promise<TableData>

Async function that loads a TableData by ID

options?

Optional abort signal, buffer alignment, and table ID

align?

number

signal?

AbortSignal

table?

string

Returns

Promise<Uint8Array<ArrayBufferLike>>

A Uint8Array of encoded marker values, one per ID


loadMarkerDataFromTableGroups()

static loadMarkerDataFromTableGroups(ids, config, markerMaps, defaultMarker, loadTable, options?): Promise<Uint8Array<ArrayBufferLike>>

Defined in: utils/data/MarkerDataUtils.ts:152

Loads marker data by grouping IDs via a table column and mapping each group to a marker using either a marker map or the default marker palette.

Parameters

ids

number[]

Ordered list of item IDs

config

GroupByConfig<false, unknown>

GroupBy configuration specifying the source column and optional map

markerMaps

DefaultMap<Marker>[]

Available marker maps for group-to-marker lookups

defaultMarker

Marker

Fallback marker when the map is not found or a group is unmapped

loadTable

(options?) => Promise<TableData>

Async function that loads the TableData

options?

Optional abort signal and buffer alignment

align?

number

signal?

AbortSignal

Returns

Promise<Uint8Array<ArrayBufferLike>>

A Uint8Array of encoded marker values


loadMarkerDataFromTableValues()

static loadMarkerDataFromTableValues(ids, config, defaultMarker, loadTable, options?): Promise<Uint8Array<ArrayBufferLike>>

Defined in: utils/data/MarkerDataUtils.ts:116

Loads marker data by reading values from a table column and parsing them as markers.

Parameters

ids

number[]

Ordered list of item IDs

config

FromConfig<unknown>

From configuration specifying the source column

defaultMarker

Marker

Fallback marker when a value is missing or invalid

loadTable

(options?) => Promise<TableData>

Async function that loads the TableData

options?

Optional abort signal and buffer alignment

align?

number

signal?

AbortSignal

Returns

Promise<Uint8Array<ArrayBufferLike>>

A Uint8Array of encoded marker values


loadUniformMarkerData()

static loadUniformMarkerData(ids, config, options?): Uint8Array

Defined in: utils/data/MarkerDataUtils.ts:93

Creates a uniform marker data buffer filled with the configured constant marker.

Parameters

ids

number[]

Ordered list of item IDs (only the length is used)

config

ConstantConfig<Marker, unknown>

Constant marker configuration containing the marker value

options?

Optional buffer alignment

align?

number

Returns

Uint8Array

A Uint8Array filled with the encoded constant marker


parseMarkerValue()

static parseMarkerValue(value): Marker | undefined

Defined in: utils/data/MarkerDataUtils.ts:234

Parses a raw value as a Marker.

Parameters

value

unknown

The raw value to parse (must be a number)

Returns

Marker | undefined

The value cast to a Marker, or undefined if not a number