JavaScript & React libraryAPIClassesCosmograph

Class: Cosmograph

Public Cosmograph API interface.

Implements

Constructors

Constructor

new Cosmograph(containerElement, config, duckDbConnection?): Cosmograph

Creates a new instance of the Cosmograph class.

Parameters

ParameterTypeDescription
containerElementHTMLElementThe HTML div element that will contain the Cosmograph visualization.
configCosmographConfigThe configuration options for the Cosmograph instance.
duckDbConnection?string | WasmDuckDBConnection(Optional) The connection string or WasmDuckDBConnection instance for the DuckDB database.

Returns

Cosmograph

Accessors

stats

Get Signature

get stats(): CosmographStats

Statistical information about current points and links in the graph.

Returns

CosmographStats

An object containing the count of points and links and summaries of points and links data.

Summaries include:

  • Column names and types
  • Aggregates for each column (count, min, max, approx_unique, avg, std, q25, q50, q75)
  • Percentage of NULL values

Statistical information about current points and links in the graph.

Implementation of

ICosmograph.stats


crossfilter

Get Signature

get crossfilter(): Crossfilter

Gets the crossfilter sets for links, points, and their intersection.

Returns

Crossfilter

An object containing the crossfiltered indices Sets.

Gets the crossfilter sets for links, points, and their intersection.

Implementation of

ICosmograph.crossfilter


progress

Get Signature

get progress(): undefined | number

A value that gives information about the running simulation progress.

Returns

undefined | number

The current progress of the simulation, where 0 represents the start of the simulation and 1 represents the end, or undefined if not available.

A value that gives information about the running simulation progress.

Implementation of

ICosmograph.progress


isSimulationRunning

Get Signature

get isSimulationRunning(): undefined | boolean

Gets a boolean indicating whether the simulation is currently running.

Returns

undefined | boolean

true if the simulation is running, false if it is not running, or undefined if the information is not available.

Gets a boolean indicating whether the simulation is currently running.

Implementation of

ICosmograph.isSimulationRunning


isSimulationAvailable

Get Signature

get isSimulationAvailable(): boolean

Gets a boolean indicating if a simulation can run for the current graph configuration and data.

Remarks

Determined on graph init/rebuild. Based on enableSimulation config (if set), or defaults to true if links exist or points lack layout (pointXBy/pointYBy).

The value updates upon graph initialization or rebuild (e.g., after setConfig or data loading).

Returns

boolean

true if a simulation can run, false otherwise.

Gets a boolean indicating if a simulation can run for the current graph configuration and data.

Remarks

Determined on graph init/rebuild. Based on enableSimulation config (if set), or defaults to true if links exist or points lack layout (pointXBy/pointYBy).

The value updates upon graph initialization or rebuild (e.g., after setConfig or data loading).

Implementation of

ICosmograph.isSimulationAvailable


pointDegrees

Get Signature

get pointDegrees(): undefined | number[]

Gets the point degrees for the current graph.

Returns

undefined | number[]

The point degrees as an array of their degree values in the order they were sent to Cosmograph, or undefined if not available.

Gets the point degrees for the current graph.

Implementation of

ICosmograph.pointDegrees


maxPointSize

Get Signature

get maxPointSize(): number

Gets the maximum point size. This value is the maximum size of the gl.POINTS primitive that WebGL can render on the user’s hardware.

Returns

number

The maximum point size, or 0 if not available.

Gets the maximum point size. This value is the maximum size of the gl.POINTS primitive that WebGL can render on the user’s hardware.

Implementation of

ICosmograph.maxPointSize


activePointColorStrategy

Get Signature

get activePointColorStrategy(): "map" | "palette" | "interpolatePalette" | "degree" | "direct"

Provides the active point color strategy for the Cosmograph instance.

Returns

"map" | "palette" | "interpolatePalette" | "degree" | "direct"

The active point color strategy.

Provides the active point color strategy for the Cosmograph instance.

Implementation of

ICosmograph.activePointColorStrategy


activePointSizeStrategy

Get Signature

get activePointSizeStrategy(): "auto" | "degree" | "direct"

Provides the active point size strategy for the Cosmograph instance.

Returns

"auto" | "degree" | "direct"

The active point size strategy.

Provides the active point size strategy for the Cosmograph instance.

Implementation of

ICosmograph.activePointSizeStrategy


focusedPointIndex

Get Signature

get focusedPointIndex(): undefined | number

Gets the index of the currently focused point.

Returns

undefined | number

The index of the focused point, or undefined if no point is focused.

Gets the index of the currently focused point.

Implementation of

ICosmograph.focusedPointIndex


clusterMapping

Get Signature

get clusterMapping(): Map<string, { index: number; count: number; }>

Gets the mapping of cluster values to their auto-generated indices and counts of items in each cluster.

Remarks

If pointClusterByFn is provided, keys of map will be values of pointClusterBy after applying pointClusterByFn.

Returns

Map<string, { index: number; count: number; }>

Gets the mapping of cluster values to their auto-generated indices and counts of items in each cluster.

Remarks

If pointClusterByFn is provided, keys of map will be values of pointClusterBy after applying pointClusterByFn.

Implementation of

ICosmograph.clusterMapping


rescaleXFn

Get Signature

get rescaleXFn(): undefined | (x) => number

Gets the callback function for rescaling the x-axis.

Returns

undefined | (x) => number

The callback function for rescaling the x-axis, or undefined if not set.

Gets the callback function for rescaling the x-axis.

Implementation of

ICosmograph.rescaleXFn


rescaleYFn

Get Signature

get rescaleYFn(): undefined | (y) => number

Gets the callback function for rescaling the y-axis.

Returns

undefined | (y) => number

The callback function for rescaling the y-axis, or undefined if not set.

Gets the callback function for rescaling the y-axis.

Implementation of

ICosmograph.rescaleYFn


linksTableName

Get Signature

get linksTableName(): string

Provides the name of the links table used by the Cosmograph instance.

Returns

string

The name of the links table.

Provides the name of the links table used by the Cosmograph instance.

Implementation of

ICosmograph.linksTableName


pointsTableName

Get Signature

get pointsTableName(): string

Provides the name of the points table used by the Cosmograph instance.

Returns

string

The name of the points table.

Provides the name of the points table used by the Cosmograph instance.

Implementation of

ICosmograph.pointsTableName

Methods

dataUploaded()

dataUploaded(): Promise<void>

Waits for the data upload promise to resolve, if it exists. This method is used to ensure that any necessary data has been uploaded before proceeding with other operations.

Returns

Promise<void>

A promise that resolves when the data is ready.

Implementation of

ICosmograph.dataUploaded


getConfig()

getConfig(): Promise<CosmographConfig>

Retrieves the current configuration of the Cosmograph.

Returns

Promise<CosmographConfig>

A promise that resolves with the current Cosmograph configuration.

Implementation of

ICosmograph.getConfig


getActivePointColorFn()

getActivePointColorFn(): Promise<undefined | ColorAccessorFn>

Gets the current coloring function.

Returns

Promise<undefined | ColorAccessorFn>

The point coloring function, or undefined if not available.

Implementation of

ICosmograph.getActivePointColorFn


getActivePointSizeFn()

getActivePointSizeFn(): Promise<undefined | SizeAccessorFn>

Gets the current point sizing function.

Returns

Promise<undefined | SizeAccessorFn>

The point sizing function, or undefined if not available.

Implementation of

ICosmograph.getActivePointSizeFn


getActiveLinkColorFn()

getActiveLinkColorFn(): Promise<undefined | ColorAccessorFn>

Gets the current link coloring function.

Returns

Promise<undefined | ColorAccessorFn>

The link coloring function, or undefined if not available.

Implementation of

ICosmograph.getActiveLinkColorFn


getActiveLinkWidthFn()

getActiveLinkWidthFn(): Promise<undefined | SizeAccessorFn>

Gets the current link width function.

Returns

Promise<undefined | SizeAccessorFn>

The link width function, or undefined if not available.

Implementation of

ICosmograph.getActiveLinkWidthFn


setConfig()

setConfig(config?): Promise<void>

Sets the config for the Cosmograph.

Parameters

ParameterTypeDescription
config?CosmographConfigConfig to be applied to the Cosmograph.

Returns

Promise<void>

Implementation of

ICosmograph.setConfig


captureScreenshot()

captureScreenshot(fileName): void

Captures a screenshot of the current graph view.

Parameters

ParameterTypeDefault valueDescription
fileNamestring'cosmograph-screenshot.png'Optional name for the downloaded file (default: ā€˜cosmograph-screenshot.png’).

Returns

void

Implementation of

ICosmograph.captureScreenshot


getPointPositions()

getPointPositions(): undefined | number[]

Gets the current X and Y coordinates of the points.

Returns

undefined | number[]

Array of point positions.

Implementation of

ICosmograph.getPointPositions


getClusterPositions()

getClusterPositions(): undefined | number[]

Gets the current X and Y coordinates of the clusters.

Returns

undefined | number[]

Array of point cluster positions.

Implementation of

ICosmograph.getClusterPositions


getPointColors()

getPointColors(): undefined | Float32Array<ArrayBufferLike>

Gets the current colors for each point.

Returns

undefined | Float32Array<ArrayBufferLike>

A Float32Array containing RGBA color values for each point, or undefined if not available.

Implementation of

ICosmograph.getPointColors


getPointSizes()

getPointSizes(): undefined | Float32Array<ArrayBufferLike>

Gets the current sizes for each point.

Returns

undefined | Float32Array<ArrayBufferLike>

A Float32Array containing size values for each point, or undefined if not available.

Implementation of

ICosmograph.getPointSizes


getLinkColors()

getLinkColors(): undefined | Float32Array<ArrayBufferLike>

Gets the current colors for each link.

Returns

undefined | Float32Array<ArrayBufferLike>

A Float32Array containing RGBA color values for each link, or undefined if not available.

Implementation of

ICosmograph.getLinkColors


getLinkWidths()

getLinkWidths(): undefined | Float32Array<ArrayBufferLike>

Gets the current widths for each link.

Returns

undefined | Float32Array<ArrayBufferLike>

A Float32Array containing width values for each link, or undefined if not available.

Implementation of

ICosmograph.getLinkWidths


getPointPositionByIndex()

getPointPositionByIndex(index): undefined | [number, number]

Gets the current X and Y coordinates of a point by its index.

Parameters

ParameterTypeDescription
indexnumberPoint index.

Returns

undefined | [number, number]

Array with X and Y coordinates of the point, or undefined if the point index is invalid.

Implementation of

ICosmograph.getPointPositionByIndex


activateRectSelection()

activateRectSelection(): void

Activates the rectangular selection element.

Returns

void

Implementation of

ICosmograph.activateRectSelection


deactivateRectSelection()

deactivateRectSelection(): void

Deactivates the rectangular selection element.

Returns

void

Implementation of

ICosmograph.deactivateRectSelection


activatePolygonalSelection()

activatePolygonalSelection(): void

Activates the polygonal selection element.

Returns

void

Implementation of

ICosmograph.activatePolygonalSelection


deactivatePolygonalSelection()

deactivatePolygonalSelection(): void

Deactivates the polygonal selection element.

Returns

void

Implementation of

ICosmograph.deactivatePolygonalSelection


getSelectedPointIndices()

getSelectedPointIndices(): undefined | null | number[]

Get indices for currently selected points.

Returns

undefined | null | number[]

Array of selected point indices.

Implementation of

ICosmograph.getSelectedPointIndices


selectPointsInRect()

selectPointsInRect(selection, addToSelection): void

Selects points inside a rectangular area.

Parameters

ParameterTypeDefault valueDescription
selectionnull | [[number, number], [number, number]]undefinedArray of two corners of the rectangle [[left, top], [right, bottom]].
addToSelectionbooleanfalse-

Returns

void

Implementation of

ICosmograph.selectPointsInRect


selectPointsInPolygon()

selectPointsInPolygon(polygonPoints, addToSelection): void

Selects points inside a polygonal polygon.

Parameters

ParameterTypeDefault valueDescription
polygonPoints[number, number][]undefined-
addToSelectionbooleanfalseOptional parameter determining whether to add the points to the current selection.

Returns

void

Implementation of

ICosmograph.selectPointsInPolygon


unselectPointsInRect()

unselectPointsInRect(selection): void

Parameters

ParameterType
selectionnull | [[number, number], [number, number]]

Returns

void


unselectPointsInPolygon()

unselectPointsInPolygon(polygonPoints): void

Parameters

ParameterType
polygonPoints[number, number][]

Returns

void


selectPoints()

selectPoints(pointIndices, addToSelection): void

Selects points.

Parameters

ParameterTypeDefault valueDescription
pointIndicesnull | number[]undefinedArray of point indices to be selected.
addToSelectionbooleanfalse-

Returns

void

Implementation of

ICosmograph.selectPoints


selectPoint()

selectPoint(pointIndexBy?, addToSelection?, selectConnectedPoints?): void

Selects a point and, optionally, its connected points.

Parameters

ParameterTypeDefault valueDescription
pointIndexBy?numberundefinedSelected point index.
addToSelection?booleanfalseOptional parameter determining whether to add the point to the current selection.
selectConnectedPoints?boolean...Optional parameter determining whether to also select the connected points.

Returns

void

Implementation of

ICosmograph.selectPoint


unselectPoint()

unselectPoint(pointIndexBy?, unselectConnectedPoints?): void

Unselects a point and, optionally, its connected points.

Parameters

ParameterTypeDescription
pointIndexBy?numberSelected point index.
unselectConnectedPoints?booleanOptional parameter determining whether to also unselect the connected points.

Returns

void

Implementation of

ICosmograph.unselectPoint


unselectPointsByIndicies()

unselectPointsByIndicies(indicesToRemove): void

Unselects points by indices.

Parameters

ParameterTypeDescription
indicesToRemovenumber[]Array of point indices to be unselected.

Returns

void

Implementation of

ICosmograph.unselectPointsByIndicies


unselectAllPoints()

unselectAllPoints(): void

Unselects all points.

Returns

void

Implementation of

ICosmograph.unselectAllPoints


setFocusedPoint()

setFocusedPoint(index?): void

Sets focus on a point by index. Draws a ring around the focused point.

Parameters

ParameterTypeDescription
index?numberIndex of the point to be focused.

Returns

void

Remarks

If focusedPointIndex is set, it will have priority over this method.

Implementation of

ICosmograph.setFocusedPoint


start()

start(alpha): void

Starts the simulation.

Parameters

ParameterTypeDefault valueDescription
alphanumber1Value between 0 and 1. The higher the value, the more energy the simulation gets.

Returns

void

Implementation of

ICosmograph.start


pause()

pause(): void

Pauses the simulation.

Returns

void

Implementation of

ICosmograph.pause


restart()

restart(): void

Restarts the simulation.

Returns

void

Implementation of

ICosmograph.restart


step()

step(): void

Renders only one frame of the simulation (stops the simulation if it was running).

Returns

void

Implementation of

ICosmograph.step


setZoomLevel()

setZoomLevel(value, duration): void

Zooms the view in or out to the specified zoom level.

Parameters

ParameterTypeDefault valueDescription
valuenumberundefinedZoom level.
durationnumber0Duration of the zoom transition.

Returns

void

Implementation of

ICosmograph.setZoomLevel


getZoomLevel()

getZoomLevel(): undefined | number

Gets the zoom level of the view.

Returns

undefined | number

Zoom level value.

Implementation of

ICosmograph.getZoomLevel


zoomToPoint()

zoomToPoint(index, duration, scale?, canZoomOut?): void

Centers the view and zooms in to a point by its index.

Parameters

ParameterTypeDescription
indexnumberPoint index to be zoomed in.
durationundefined | numberOptional duration in milliseconds.
scale?numberOptional zoom level.
canZoomOut?booleanOptional parameter determining whether the view can zoom out.

Returns

void

Implementation of

ICosmograph.zoomToPoint


fitView()

fitView(duration, padding): void

Centers and zooms the view to fit all points in the scene.

Parameters

ParameterTypeDescription
durationundefined | numberDuration of the animation (default: 250ms).
paddingundefined | numberPadding around the viewport (0 to 1 as 100% of the viewport, default 0.1.

Returns

void

Implementation of

ICosmograph.fitView


fitViewByIndices()

fitViewByIndices(indices, duration, padding): void

Centers and zooms the viewport to fit points based on their indices.

Parameters

ParameterTypeDescription
indicesnumber[]Array of point indices.
durationundefined | numberDuration of the animation (default: 250ms).
paddingundefined | numberPadding around the viewport (0 to 1 as 100% of the viewport, default 0.1.

Returns

void

Implementation of

ICosmograph.fitViewByIndices


fitViewByCoordinates()

fitViewByCoordinates(coordinates, duration, padding): void

Fits the given coordinates into the viewport.

Parameters

ParameterTypeDescription
coordinatesnumber[]Array of coordinates in the format [x0, y0, x1, y1, …].
durationundefined | numberDuration of the animation (default: 250ms).
paddingundefined | numberPadding around the viewport (0 to 1 as 100% of the viewport, default 0.1).

Returns

void

Implementation of

ICosmograph.fitViewByCoordinates


getConnectedPointIndices()

getConnectedPointIndices(index): undefined | number[]

Gets the indices of the points that are connected to the point with the given index.

Parameters

ParameterTypeDescription
indexnumberThe index of the point to get the connected points for.

Returns

undefined | number[]

An array of indices of the connected points, or undefined if the point index is invalid or there are no connected points.

Implementation of

ICosmograph.getConnectedPointIndices


spaceToScreenPosition()

spaceToScreenPosition(spacePosition): undefined | [number, number]

Converts the X and Y point coordinates from the space coordinate system to the screen coordinate system.

Parameters

ParameterTypeDescription
spacePosition[number, number]Array of x and y coordinates in the space coordinate system.

Returns

undefined | [number, number]

Array of x and y coordinates in the screen coordinate system.

Implementation of

ICosmograph.spaceToScreenPosition


screenToSpacePosition()

screenToSpacePosition(screenPosition): undefined | [number, number]

Converts the X and Y point coordinates from the screen coordinate system to the space coordinate system.

Parameters

ParameterTypeDescription
screenPosition[number, number]Array of x and y coordinates in the screen coordinate system.

Returns

undefined | [number, number]

Array of x and y coordinates in the space coordinate system.

Implementation of

ICosmograph.screenToSpacePosition


spaceToScreenRadius()

spaceToScreenRadius(spaceRadius): undefined | number

Converts the point radius value from the space coordinate system to the screen coordinate system.

Parameters

ParameterTypeDescription
spaceRadiusnumberRadius of the point in the space coordinate system.

Returns

undefined | number

Radius of the point in the screen coordinate system.

Implementation of

ICosmograph.spaceToScreenRadius


getPointRadiusByIndex()

getPointRadiusByIndex(index): undefined | number

Get point space radius by its index.

Parameters

ParameterTypeDescription
indexnumberIndex of the point.

Returns

undefined | number

Radius of the point in the space coordinate system.

Implementation of

ICosmograph.getPointRadiusByIndex


getPointScreenRadiusByIndex()

getPointScreenRadiusByIndex(index): number

Get point screen radius by its index.

Parameters

ParameterTypeDescription
indexnumberIndex of the point.

Returns

number

Radius of the point in the screen coordinate system.

Implementation of

ICosmograph.getPointScreenRadiusByIndex


trackPointPositionsByIndices()

trackPointPositionsByIndices(indices): void

Tracks point positions by indices on each simulation tick. Once tracking is enabled, use getTrackedPointPositionsArray or getTrackedPointPositionsMap to retrieve the current positions.

Parameters

ParameterTypeDescription
indicesnumber[]Array of point indices.

Returns

void

See

Implementation of

ICosmograph.trackPointPositionsByIndices


getTrackedPointPositionsArray()

getTrackedPointPositionsArray(): undefined | number[]

Gets an array of point positions that are currently tracked by the renderer. Use trackPointPositionsByIndices to specify which points to track.

Returns

undefined | number[]

A flattened array of point positions [x0, y0, x1, y1, ...] for tracked points, or undefined if not available.

See

Implementation of

ICosmograph.getTrackedPointPositionsArray


getTrackedPointPositionsMap()

getTrackedPointPositionsMap(): undefined | Map<number, [number, number]>

Gets a Map of point positions that are currently tracked by the renderer. Use trackPointPositionsByIndices to specify which points to track.

Returns

undefined | Map<number, [number, number]>

A Map where keys are point indices and values are their corresponding X, Y coordinates, or undefined if not available.

See

Implementation of

ICosmograph.getTrackedPointPositionsMap


getSampledPoints()

getSampledPoints(): undefined | { indices: number[]; positions: number[]; }

Retrieves sampled point data as arrays with indices and positions.

Returns

undefined | { indices: number[]; positions: number[]; }

An object containing separate arrays for point indices and their corresponding positions, or undefined if not available. The indices array contains point indices, and the positions array contains flattened coordinates [x0, y0, x1, y1, ...].

Implementation of

ICosmograph.getSampledPoints


getSampledPointPositionsMap()

getSampledPointPositionsMap(): undefined | Map<number, [number, number]>

For the points that are currently visible on the screen, get a sample of point ids with their coordinates. The resulting number of points will depend on the pointSamplingDistance configuration property, and the sampled points will be evenly distributed.

Returns

undefined | Map<number, [number, number]>

A Map where keys are the ids of the points and values are their corresponding X and Y coordinates.

Implementation of

ICosmograph.getSampledPointPositionsMap


getPointIndicesByIds()

getPointIndicesByIds(ids): Promise<undefined | number[]>

Returns an array of point indices in the order they were sent to getPointIndicesByIds.

Parameters

ParameterTypeDescription
idsstring[]Array of point ids.

Returns

Promise<undefined | number[]>

A Promise resolving to an array of point indices.

Implementation of

ICosmograph.getPointIndicesByIds


getPointIdsByIndices()

getPointIdsByIndices(indices): Promise<undefined | string[]>

Returns an array of point ids in the order they were sent to getPointIdsByIndices.

Parameters

ParameterTypeDescription
indicesnumber[]Array of point indices.

Returns

Promise<undefined | string[]>

A Promise resolving to an array of point ids.

Implementation of

ICosmograph.getPointIdsByIndices


getPointsByIndices()

getPointsByIndices(indices): Promise<undefined | CosmographData>

Returns points entries as a CosmographData table by their indices.

Parameters

ParameterTypeDescription
indicesnumber[]Array of point indices.

Returns

Promise<undefined | CosmographData>

A Promise resolving to a CosmographData table of points.

Implementation of

ICosmograph.getPointsByIndices


getPointIndicesByExactValues()

getPointIndicesByExactValues(column, values): Promise<undefined | number[]>

Returns an array of point indices that match the provided values in a column.

Parameters

ParameterTypeDescription
columnstringThe column to filter by.
values(string | number)[]The values to match in the specified column.

Returns

Promise<undefined | number[]>

A Promise resolving to an array of point indices, or undefined if the operation fails.

Implementation of

ICosmograph.getPointIndicesByExactValues


getPointIndicesByNumericValue()

getPointIndicesByNumericValue(column, value, isMax): Promise<undefined | number[]>

Returns an array of point indices that match the provided numeric value in the specified column.

Parameters

ParameterTypeDescription
columnstringThe column in the points table to filter by.
valuestring | numberThe numeric value to match in the specified column.
isMaxbooleanIndicates whether to return the indices for the maximum or minimum value.

Returns

Promise<undefined | number[]>

A Promise resolving to an array of point indices, or undefined if the operation fails.

Implementation of

ICosmograph.getPointIndicesByNumericValue


getPointIndicesByLinksExactValues()

getPointIndicesByLinksExactValues(column, values): Promise<undefined | number[]>

Returns an array of point indices that match the provided link column values.

Parameters

ParameterTypeDescription
columnstringThe column in the links table to filter by.
values(string | number)[]The values to match in the specified column.

Returns

Promise<undefined | number[]>

A Promise resolving to an array of point indices.

Implementation of

ICosmograph.getPointIndicesByLinksExactValues


getPointIndicesByLinksNumericValue()

getPointIndicesByLinksNumericValue(column, value, isMax): Promise<undefined | number[]>

Returns an array of point indices that match the provided link column numeric value.

Parameters

ParameterTypeDescription
columnstringThe column in the links table to filter by.
valuestring | numberThe numeric value to match in the specified column.
isMaxbooleanIndicates whether to return the indices for the maximum or minimum value.

Returns

Promise<undefined | number[]>

A Promise resolving to an array of point indices.

Implementation of

ICosmograph.getPointIndicesByLinksNumericValue


getLinksByPointIds()

getLinksByPointIds(ids): Promise<undefined | CosmographData>

Returns links entries as a CosmographData table where the source or target point id is in the provided array.

Parameters

ParameterTypeDescription
idsstring[]Array of point ids.

Returns

Promise<undefined | CosmographData>

A Promise resolving to a CosmographData table of links.

Implementation of

ICosmograph.getLinksByPointIds


getLinksByPointIndices()

getLinksByPointIndices(indices): Promise<undefined | CosmographData>

Returns links entries as a CosmographData table where the source or target point index is in the provided array.

Parameters

ParameterTypeDescription
indicesnumber[]Array of point indices.

Returns

Promise<undefined | CosmographData>

A Promise resolving to a CosmographData table of links.

Implementation of

ICosmograph.getLinksByPointIndices


getLinksData()

getLinksData(): Promise<undefined | CosmographData>

Returns all links entries as a CosmographData table.

Returns

Promise<undefined | CosmographData>

A Promise resolving to a CosmographData table of links.

Implementation of

ICosmograph.getLinksData


getPointsData()

getPointsData(): Promise<undefined | CosmographData>

Returns all points entries as a CosmographData table.

Returns

Promise<undefined | CosmographData>

A Promise resolving to a CosmographData table of points.

Implementation of

ICosmograph.getPointsData


convertCosmographDataToObject()

convertCosmographDataToObject(data): Record<string, unknown>[]

Converts a CosmographData table to an array of objects.

Parameters

ParameterTypeDescription
dataCosmographDataCosmographData table.

Returns

Record<string, unknown>[]

An array of objects.

Implementation of

ICosmograph.convertCosmographDataToObject


flattenPositions()

flattenPositions(positions): undefined | number[]

Converts an array of tuple positions to a single flattened array containing all coordinates sequentially.

Parameters

ParameterTypeDescription
positions[number, number][]An array of tuple positions.

Returns

undefined | number[]

A flattened array of coordinates.

Implementation of

ICosmograph.flattenPositions


pair()

pair(pointPositions): undefined | [number, number][]

Converts a flat array of point positions to tuple pairs representing coordinates.

Parameters

ParameterTypeDescription
pointPositionsnumber[]A flattened array of coordinates.

Returns

undefined | [number, number][]

An array of tuple positions.

Implementation of

ICosmograph.pair


addPoints()

addPoints(points): Promise<void>

Adds points to the Cosmograph instance.

Parameters

ParameterTypeDescription
pointsCosmographPointInput[]The points data to add.

Returns

Promise<void>

A promise that resolves when the points have been added.

Remarks

Minimal to provide is point a id. Other fields are optional, should respect already existing fields in the points data, if not provided, will be filled with default values.

Implementation of

ICosmograph.addPoints


addLinks(links): Promise<void>

Adds links to the Cosmograph instance.

Parameters

ParameterTypeDescription
linksCosmographLinkInput[]The links data to add.

Returns

Promise<void>

A promise that resolves when the links have been added.

Remarks

Minimal to provide is a source point and target point id. Other fields are optional, should respect already existing fields in the links data, if not provided, will be filled with default values.

Implementation of

ICosmograph.addLinks


removePointsByIndices()

removePointsByIndices(indices, removeAttachedLinks): Promise<void>

Removes points from the Cosmograph instance by their indices.

Parameters

ParameterTypeDefault valueDescription
indicesnumber[]undefinedThe indices of the points to remove.
removeAttachedLinksbooleantrueWhether to also remove links attached to the points.

Returns

Promise<void>

A promise that resolves when the points have been removed.

Implementation of

ICosmograph.removePointsByIndices


removePointsByIds()

removePointsByIds(ids): Promise<void>

Removes points from the Cosmograph instance by their IDs.

Parameters

ParameterTypeDescription
idsstring[]The IDs of the points to remove.

Returns

Promise<void>

A promise that resolves when the points have been removed.

Implementation of

ICosmograph.removePointsByIds


removeLinksByPointIdPairs()

removeLinksByPointIdPairs(pairs): Promise<void>

Removes links from the Cosmograph instance by their point ID pairs.

Parameters

ParameterTypeDescription
pairs[string, string][]The point ID pairs of the links to remove.

Returns

Promise<void>

A promise that resolves when the links have been removed.

Implementation of

ICosmograph.removeLinksByPointIdPairs


removeLinksByPointIndicesPairs()

removeLinksByPointIndicesPairs(pairs): Promise<void>

Removes links from the Cosmograph instance by their point indices pairs.

Parameters

ParameterTypeDescription
pairs[number, number][]The point indices pairs of the links to remove.

Returns

Promise<void>

A promise that resolves when the links have been removed.

Implementation of

ICosmograph.removeLinksByPointIndicesPairs


reset()

reset(total): Promise<void>

Resets the Cosmograph instance to its initial state.

Parameters

ParameterTypeDefault valueDescription
totalbooleantrueIf true, resets configuration and displays the message div.

Returns

Promise<void>

A promise that resolves when the reset operation is complete.

Implementation of

ICosmograph.reset


destroy()

destroy(): Promise<void>

Destroys the Cosmograph instance and cleans up associated resources.

Returns

Promise<void>

A promise that resolves when the destroy operation is complete.

Implementation of

ICosmograph.destroy