JavaScript & React libraryAPI Generated Docs

Class: GraphData

Constructors

Constructor

new GraphData(config): GraphData

Parameters

ParameterType
configGraphConfigInterface

Returns

GraphData

Properties

PropertyTypeDescription
inputPointPositionsFloat32Array<ArrayBufferLike> | undefined-
inputPointDimensions2 | 3Number of coordinates per point in inputPointPositions: 2 for [x, y, ...], 3 for [x, y, z, ...]. Applied to pointDimensions on updatePoints().
inputPointColorsFloat32Array<ArrayBufferLike> | undefined-
inputPointSizesFloat32Array<ArrayBufferLike> | undefined-
inputPointShapesFloat32Array<ArrayBufferLike> | undefined-
inputImageDataImageData[] | undefined-
inputPointImageIndicesFloat32Array<ArrayBufferLike> | undefined-
inputPointImageSizesFloat32Array<ArrayBufferLike> | undefined-
inputLinkColorsFloat32Array<ArrayBufferLike> | undefined-
inputLinkWidthsFloat32Array<ArrayBufferLike> | undefined-
inputLinkStylesFloat32Array<ArrayBufferLike> | undefinedRaw per-link stroke patterns from setLinkStyles (LinkStyle per link); sanitized into linkStyles.
inputLinkStrengthFloat32Array<ArrayBufferLike> | undefined-
inputPointClusters(number | undefined)[] | undefined-
inputClusterPositions(number | undefined)[] | undefined-
inputClusterPositionsDimensions2 | 3Number of coordinates per cluster in inputClusterPositions: 2 for [x, y, ...], 3 for [x, y, z, ...]. Applied to clusterPositionsDimensions on updateClusters().
inputClusterStrengthFloat32Array<ArrayBufferLike> | undefined-
inputPinnedPointsnumber[] | undefined-
pointPositionsFloat32Array<ArrayBufferLike> | undefined-
pointDimensions2 | 3Number of coordinates per point in pointPositions (see inputPointDimensions).
sourcePointsNumbernumberNumber of points before the latest data update. Used as the from value for point transitions. This lets transitions handle added or removed points correctly.
targetPointsNumbernumberNumber of points after the latest data update. Used as the to value for point transitions. This lets transitions handle added or removed points correctly.
pointColorsFloat32Array<ArrayBufferLike> | undefined-
pointSizesFloat32Array<ArrayBufferLike> | undefined-
pointShapesFloat32Array<ArrayBufferLike> | undefined-
pointImageIndicesFloat32Array<ArrayBufferLike> | undefined-
pointImageSizesFloat32Array<ArrayBufferLike> | undefined-
inputLinksFloat32Array<ArrayBufferLike> | undefined-
linksFloat32Array<ArrayBufferLike> | undefined-
linkColorsFloat32Array<ArrayBufferLike> | undefined-
linkWidthsFloat32Array<ArrayBufferLike> | undefined-
linkStylesFloat32Array<ArrayBufferLike> | undefinedSanitized per-link stroke patterns (integer LinkStyle values) that the Lines module uploads.
linkArrowsBooleanboolean[] | undefined-
linkArrowsnumber[] | undefined-
linkStrengthFloat32Array<ArrayBufferLike> | undefined-
pointClusters(number | undefined)[] | undefined-
clusterPositions(number | undefined)[] | undefined-
clusterPositionsDimensions2 | 3Number of coordinates per cluster in clusterPositions (see inputClusterPositionsDimensions).
clusterStrengthFloat32Array<ArrayBufferLike> | undefined-
sourceIndexToTargetIndices([number, number][] | undefined)[] | undefinedEach inner array of sourceIndexToTargetIndices and targetIndexToSourceIndices contains pairs where: - The first value is the target/source index in the point array. - The second value is the link index in the array of links.
targetIndexToSourceIndices([number, number][] | undefined)[] | undefined-
degreenumber[] | undefined-
inDegreenumber[] | undefined-
outDegreenumber[] | undefined-

Accessors

pointsNumber

Get Signature

get pointsNumber(): number | undefined

Returns

number | undefined


defaultRgba

Get Signature

get defaultRgba(): [number, number, number, number]

Parsed pointDefaultColor, cached between updates (updatePointColor invalidates it, so config changes are picked up). Public so the draw pass can feed it to the shader’s pointDefaultColor uniform without re-parsing the config color string every frame.

Returns

[number, number, number, number]


linksNumber

Get Signature

get linksNumber(): number | undefined

Returns

number | undefined

Methods

hasPointAbsenceChanged()

hasPointAbsenceChanged(): boolean

Reports whether any point’s absence (NaN position) differs between the applied positions and the pending input, over their shared length — i.e. whether the pending update removes (real → NaN) or revives (NaN → real) a point. Slots beyond the shared length don’t count: a slot that enters already absent has nothing to fade, and a dropped slot no longer exists.

Returns

boolean


isPointAbsent()

isPointAbsent(index): boolean

Whether the point at index was removed (its position is NaN).

Parameters

ParameterType
indexnumber

Returns

boolean


updatePoints()

updatePoints(): void

Returns

void


updatePointColor()

updatePointColor(): void

Updates the point colors based on the input data or default config value.

Returns

void


getResolvedPointColorChannel()

getResolvedPointColorChannel(index, channel): number

Resolves one color channel of a point the way the draw shader does: a NaN channel means the exit default (transparent) for an absent point, the config default otherwise. The CPU mirror of the shader rule, for consumers that read colors outside the GPU.

Parameters

ParameterType
indexnumber
channelnumber

Returns

number


updatePointSize()

updatePointSize(): void

Updates the point sizes based on the input data or default config value.

Returns

void


getResolvedPointSize()

getResolvedPointSize(index): number

Resolves a point’s size the way the draw shader does: NaN means the exit default (0) for an absent point, the config default otherwise. The CPU mirror of the shader rule, for consumers that read sizes outside the GPU (collision, hover ring, read-back).

Parameters

ParameterType
indexnumber

Returns

number


updatePointShape()

updatePointShape(): void

Updates the point shapes based on the input data or default config value. Images are rendered above shapes.

Returns

void


updatePointImageIndices()

updatePointImageIndices(): void

Updates the point image indices based on the input data or default value (-1 for no image).

Returns

void


updatePointImageSizes()

updatePointImageSizes(): void

Updates the point image sizes based on the input data or default to point sizes.

Returns

void


updateLinks(): void

Returns

void


updateLinkColor()

updateLinkColor(): void

Updates the link colors based on the input data or default config value.

Returns

void


updateLinkWidth()

updateLinkWidth(): void

Updates the link width based on the input data or default config value.

Returns

void


updateLinkStyles()

updateLinkStyles(): void

Updates the link styles (stroke patterns) based on the input data or default config value.

Returns

void


updateArrows()

updateArrows(): void

Updates the link arrows based on the input data or default config value.

Returns

void


updateLinkStrength()

updateLinkStrength(): void

Returns

void


updateClusters()

updateClusters(): void

Returns

void


update()

update(): void

Returns

void


getNeighboringPointIndices()

getNeighboringPointIndices(pointIndices): number[]

Returns unique point indices that are neighbors of the given point(s) — i.e., connected by a link in either direction.

Parameters

ParameterTypeDescription
pointIndicesnumber | number[]A single point index or an array of point indices.

Returns

number[]

Array of neighboring point indices.


getConnectedLinkIndices()

getConnectedLinkIndices(pointIndices): number[]

Returns unique link indices where both the source and target endpoints are within the given point(s). Only links fully contained in the set are returned.

Parameters

ParameterTypeDescription
pointIndicesnumber | number[]A single point index or an array of point indices.

Returns

number[]

Array of link indices connecting points within the provided set.


getConnectedPointIndices()

getConnectedPointIndices(linkIndices): number[]

Returns unique point indices at the endpoints (source and target) of the given link(s).

Parameters

ParameterTypeDescription
linkIndicesnumber | number[]A single link index or an array of link indices.

Returns

number[]

Array of point indices at the ends of the provided links.