Class: Cosmograph
Public Cosmograph API interface.
Implements
Constructors
Constructor
new Cosmograph(
containerElement,config,duckDbConnection?):Cosmograph
Creates a new instance of the Cosmograph class.
Parameters
| Parameter | Type | Description |
|---|---|---|
containerElement | HTMLElement | The HTML div element that will contain the Cosmograph visualization. |
config | CosmographConfig | The 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
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
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
progress
Get Signature
get progress():
number|undefined
A value that gives information about the running simulation progress.
Returns
number | undefined
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
isSimulationRunning
Get Signature
get isSimulationRunning():
boolean|undefined
Gets a boolean indicating whether the simulation is currently running.
Returns
boolean | undefined
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():
number[] |undefined
Gets the point degrees for the current graph.
Returns
number[] | undefined
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
pointDirections
Get Signature
get pointDirections():
number[] |undefined
Gets the point directions for the current graph.
Remarks
The point directions are calculated based on the in-degree and out-degree of the points. The value is 0 if the point has only an outgoing link (source), 1 if it has both incoming and outgoing links (source+target), 2 if it has only an incoming link (target), and 3 if it has no links (not linked).
Returns
number[] | undefined
The point directions as an array of their direction values in the order they were sent to Cosmograph, or undefined if not available.
Gets the point directions for the current graph.
Remarks
The point directions are calculated based on the in-degree and out-degree of the points. The value is 0 if the point has only an outgoing link (source), 1 if it has both incoming and outgoing links (source+target), 2 if it has only an incoming link (target), and 3 if it has no links (not linked).
Implementation of
rescaleXFn
Get Signature
get rescaleXFn(): (
x) =>number|undefined
Gets the callback function for rescaling the x-axis.
Returns
(x) => number | undefined
The callback function for rescaling the x-axis, or undefined if not set.
Gets the callback function for rescaling the x-axis.
Implementation of
rescaleYFn
Get Signature
get rescaleYFn(): (
y) =>number|undefined
Gets the callback function for rescaling the y-axis.
Returns
(y) => number | undefined
The callback function for rescaling the y-axis, or undefined if not set.
Gets the callback function for rescaling the y-axis.
Implementation of
focusedPointIndex
Get Signature
get focusedPointIndex():
number|undefined
Gets the index of the currently focused point.
Returns
number | undefined
The index of the focused point, or undefined if no point is focused.
Gets the index of the currently focused point.
Implementation of
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
activePointColorStrategy
Get Signature
get activePointColorStrategy():
"map"|"categorical"|"continuous"|"degree"|"preciseDegree"|"linkDirection"|"direct"|"single"
Provides the active point color strategy for the Cosmograph instance.
Returns
"map" | "categorical" | "continuous" | "degree" | "preciseDegree" | "linkDirection" | "direct" | "single"
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"|"preciseDegree"|"direct"|"single"
Provides the active point size strategy for the Cosmograph instance.
Returns
"auto" | "degree" | "preciseDegree" | "direct" | "single"
The active point size strategy.
Provides the active point size strategy for the Cosmograph instance.
Implementation of
ICosmograph.activePointSizeStrategy
activeLinkColorStrategy
Get Signature
get activeLinkColorStrategy():
"count"|"categorical"|"direct"|"single"|"sum"|"average"
Provides the active link color strategy for the Cosmograph instance.
Returns
"count" | "categorical" | "direct" | "single" | "sum" | "average"
The active link color strategy.
Provides the active link color strategy for the Cosmograph instance.
Implementation of
ICosmograph.activeLinkColorStrategy
activeLinkWidthStrategy
Get Signature
get activeLinkWidthStrategy():
"count"|"direct"|"single"|"sum"|"average"
Provides the active link width strategy for the Cosmograph instance.
Returns
"count" | "direct" | "single" | "sum" | "average"
The active link width strategy.
Provides the active link width strategy for the Cosmograph instance.
Implementation of
ICosmograph.activeLinkWidthStrategy
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
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
is3D
Get Signature
get is3D():
boolean|undefined
Whether Cosmograph is currently rendering in 3D mode.
Returns
boolean | undefined
Whether Cosmograph is currently rendering in 3D mode.
Implementation of
pointsSelection
Get Signature
get pointsSelection():
Selection
The Mosaic selection for the points side — filter widgets, vgplot interactors, and any custom Mosaic clause source publish their clauses here. Exposes Mosaic’s standard clause/active API.
Returns
Selection
The Mosaic selection for the points side — filter widgets, vgplot interactors, and any custom Mosaic clause source publish their clauses here. Exposes Mosaic’s standard clause/active API.
Implementation of
linksSelection
Get Signature
get linksSelection():
Selection
The Mosaic selection for the links side — filter widgets, vgplot interactors, and any custom Mosaic clause source publish their clauses here. Exposes Mosaic’s standard clause/active API.
Returns
Selection
The Mosaic selection for the links side — filter widgets, vgplot interactors, and any custom Mosaic clause source publish their clauses here. Exposes Mosaic’s standard clause/active API.
Implementation of
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
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
getActivePointColorFn()
getActivePointColorFn():
Promise<ColorAccessorFn|undefined>
Gets the current coloring function.
Returns
Promise<ColorAccessorFn | undefined>
The point coloring function, or undefined if not available.
Implementation of
ICosmograph.getActivePointColorFn
getActivePointSizeFn()
getActivePointSizeFn():
Promise<SizeAccessorFn|undefined>
Gets the current point sizing function.
Returns
Promise<SizeAccessorFn | undefined>
The point sizing function, or undefined if not available.
Implementation of
ICosmograph.getActivePointSizeFn
getActiveLinkColorFn()
getActiveLinkColorFn():
Promise<ColorAccessorFn|undefined>
Gets the current link coloring function.
Returns
Promise<ColorAccessorFn | undefined>
The link coloring function, or undefined if not available.
Implementation of
ICosmograph.getActiveLinkColorFn
getActiveLinkWidthFn()
getActiveLinkWidthFn():
Promise<SizeAccessorFn|undefined>
Gets the current link width function.
Returns
Promise<SizeAccessorFn | undefined>
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
| Parameter | Type | Description |
|---|---|---|
config? | CosmographConfig | Config to be applied to the Cosmograph. |
Returns
Promise<void>
Implementation of
captureScreenshot()
captureScreenshot(
fileName,scale):void
Captures a screenshot of the current graph view.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
fileName | string | 'cosmograph-screenshot.png' | Optional name for the downloaded file (default: ‘cosmograph-screenshot.png’). |
scale | number | 2 | - |
Returns
void
Implementation of
getCanvas()
getCanvas():
HTMLCanvasElement|null
Gets the graph canvas element.
Returns
HTMLCanvasElement | null
The canvas element, or null if it is not available.
Implementation of
getPointPositions()
getPointPositions(
options?):Float32Array<ArrayBufferLike> |undefined
Gets the current point coordinates.
Parameters
| Parameter | Type |
|---|---|
options? | PositionDimensionsOptions |
Returns
Float32Array<ArrayBufferLike> | undefined
Float32Array of point positions ([x, y, ...] or [x, y, z, ...]).
Implementation of
getClusterPositions()
getClusterPositions(
options?):number[] |undefined
Gets the current X and Y coordinates of the clusters.
Parameters
| Parameter | Type |
|---|---|
options? | PositionDimensionsOptions |
Returns
number[] | undefined
Array of point cluster positions.
Implementation of
ICosmograph.getClusterPositions
getPointColors()
getPointColors():
Float32Array<ArrayBufferLike> |undefined
Gets the current colors for each point.
Returns
Float32Array<ArrayBufferLike> | undefined
A Float32Array containing RGBA color values for each point, or undefined if not available.
Implementation of
getPointSizes()
getPointSizes():
Float32Array<ArrayBufferLike> |undefined
Gets the current sizes for each point.
Returns
Float32Array<ArrayBufferLike> | undefined
A Float32Array containing size values for each point, or undefined if not available.
Implementation of
getLinkColors()
getLinkColors():
Float32Array<ArrayBufferLike> |undefined
Gets the current colors for each link.
Returns
Float32Array<ArrayBufferLike> | undefined
A Float32Array containing RGBA color values for each link, or undefined if not available.
Implementation of
getLinkWidths()
getLinkWidths():
Float32Array<ArrayBufferLike> |undefined
Gets the current widths for each link.
Returns
Float32Array<ArrayBufferLike> | undefined
A Float32Array containing width values for each link, or undefined if not available.
Implementation of
setPointShapes()
setPointShapes(
shapes):void
Parameters
| Parameter | Type |
|---|---|
shapes | CosmographPointShape[] |
Returns
void
setPointImageIndices()
setPointImageIndices(
indices):void
Parameters
| Parameter | Type |
|---|---|
indices | number[] |
Returns
void
setPointImageSizes()
setPointImageSizes(
sizes):void
Parameters
| Parameter | Type |
|---|---|
sizes | number[] |
Returns
void
setImageData()
setImageData(
imageData):void
Parameters
| Parameter | Type |
|---|---|
imageData | ImageData | ImageData[] |
Returns
void
getPointPositionByIndex()
Call Signature
getPointPositionByIndex(
index,options?): [number,number] |undefined
Gets the current X and Y coordinates of a point by its index.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | Point index. |
options? | PositionDimensionsOptions & object | - |
Returns
[number, number] | undefined
Array with X and Y coordinates of the point, or undefined if the point index is invalid.
Implementation of
ICosmograph.getPointPositionByIndex
Call Signature
getPointPositionByIndex(
index,options): [number,number,number] |undefined
Parameters
| Parameter | Type |
|---|---|
index | number |
options | PositionDimensionsOptions & object |
Returns
[number, number, number] | undefined
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():
number[] |undefined
Get the resolved point highlight — the indices currently selected on the canvas,
combining user selection, clauses on pointsSelection, and graph consistency
driven by clauses on linksSelection.
Returns
number[] | undefined
A copy of the highlighted point indices, or undefined when the points side is inactive.
Implementation of
ICosmograph.getSelectedPointIndices
getSelectedLinkIndices()
getSelectedLinkIndices():
number[] |undefined
Get the resolved link highlight — the indices currently selected on the canvas,
combining user selection, clauses on linksSelection, and graph consistency
driven by clauses on pointsSelection.
Returns
number[] | undefined
A copy of the highlighted link indices, or undefined when the links side is inactive.
Implementation of
ICosmograph.getSelectedLinkIndices
isPointHighlighted()
isPointHighlighted(
pointIndex):boolean
Returns whether the point is currently highlighted. The highlight set is the resolved combination of Mosaic clauses, user selection, and graph consistency from the link side. When the points side is inactive, every point is treated as highlighted.
Parameters
| Parameter | Type | Description |
|---|---|---|
pointIndex | number | Point index to check. |
Returns
boolean
Implementation of
ICosmograph.isPointHighlighted
selectPointsInRect()
selectPointsInRect(
rect,addToSelection):void
Selects points inside a rectangular area, plus links between them. The link selection always also picks up edges that bridge the new region to the prior selection.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
rect | [[number, number], [number, number]] | null | undefined | Two opposite corners [[left, top], [right, bottom]], or null. |
addToSelection | boolean | false | - |
Returns
void
Implementation of
ICosmograph.selectPointsInRect
selectPointsInPolygon()
selectPointsInPolygon(
polygonPoints,addToSelection):void
Selects points inside a polygonal area. Same rule as selectPointsInRect.
Parameters
| Parameter | Type | Default value |
|---|---|---|
polygonPoints | [number, number][] | undefined |
addToSelection | boolean | false |
Returns
void
Implementation of
ICosmograph.selectPointsInPolygon
unselectPointsInRect()
unselectPointsInRect(
rect):void
Removes the region’s points (and their connected links) from the current user selection.
Parameters
| Parameter | Type |
|---|---|
rect | [[number, number], [number, number]] | null |
Returns
void
Implementation of
ICosmograph.unselectPointsInRect
unselectPointsInPolygon()
unselectPointsInPolygon(
polygonPoints):void
Removes the region’s points (and their connected links) from the current user selection.
Parameters
| Parameter | Type |
|---|---|
polygonPoints | [number, number][] |
Returns
void
Implementation of
ICosmograph.unselectPointsInPolygon
selectPoints()
selectPoints(
pointIndices,addToSelection,selectConnectedPoints):void
Replace, or with addToSelection: true extend, the user point selection.
addToSelection: false (replace) clears BOTH user-selection Sets first, then applies
the new point contribution — a clean restart. addToSelection: true only adds to the
point side, leaving the link side as-is.
With selectConnectedPoints: true, also extends the link selection additively with
edges-within(input) ∪ edges-between(input, S_p_after) — links among the new region
and links bridging the new region to whatever is already selected on the point side.
selectPoints([1, 2, 3])— replace: clears both sides, then sets point side to{1, 2, 3}.selectPoints([4, 5], true)— additive: extends point selection, link side untouched.selectPoints([1, 2, 3], false, true)— replace + internal links: clears both, sets points, adds internal edges.selectPoints(null)/selectPoints([])— clears both user-selection Sets (default). Alias for unselectAll.addToSelectionis ignored fornull;selectPoints([], true, _)is a no-op.selectPoints(null, _, false)/selectPoints([], _, false)— clears the point user selection only. Alias forunselectAllPoints(false).
Parameters
| Parameter | Type | Default value |
|---|---|---|
pointIndices | number[] | null | undefined |
addToSelection | boolean | false |
selectConnectedPoints | boolean | true |
Returns
void
Implementation of
selectPoint()
selectPoint(
pointIndexBy,addToSelection,selectConnectedPoints):void
Selects a single point. Delegates to selectPoints after expanding to
{P} ∪ N(P) when selectConnectedPoints is true. addToSelection: false clears both
user-selection Sets first (clean restart); addToSelection: true adds to current.
selectConnectedPoints defaults to true (smart mode). Pass false for single-point /
point-only selection. Canvas click handlers pass the config-driven value explicitly.
Pass null to reset user selection — delegates to selectPoints(null, …). For a full
reset including Mosaic widget clauses, use resetSelection instead.
Parameters
| Parameter | Type | Default value |
|---|---|---|
pointIndexBy | number | null | undefined |
addToSelection | boolean | false |
selectConnectedPoints | boolean | true |
Returns
void
Implementation of
unselectPoint()
unselectPoint(
pointIndexBy?,unselectConnectedPoints?):void
Unselects a point. With unselectConnectedPoints: true (default), also removes incident
links from the link selection when that side is user-active. Pass false for single mode.
Canvas click handlers pass the config-driven value explicitly.
Parameters
| Parameter | Type | Default value |
|---|---|---|
pointIndexBy? | number | undefined |
unselectConnectedPoints? | boolean | true |
Returns
void
Implementation of
unselectPoints()
unselectPoints(
indicesToRemove,unselectConnectedPoints):void
Removes the given points from the current user point selection. With
unselectConnectedPoints: true, also removes the points’ incident links from the
link selection. Symmetric naming with selectPoints.
Parameters
| Parameter | Type | Default value |
|---|---|---|
indicesToRemove | number[] | undefined |
unselectConnectedPoints | boolean | true |
Returns
void
Implementation of
unselectPointsByIndices()
unselectPointsByIndices(
indicesToRemove,unselectConnectedPoints):void
Parameters
| Parameter | Type | Default value |
|---|---|---|
indicesToRemove | number[] | undefined |
unselectConnectedPoints | boolean | true |
Returns
void
Deprecated
Use unselectPoints instead.
Implementation of
ICosmograph.unselectPointsByIndices
unselectAllPoints()
unselectAllPoints(
alsoUnselectLinks):void
Clears the point user selection and drops the focused point. Default (true) also clears
the link user selection — alias for unselectAll. Pass false for point side only.
Does NOT touch Mosaic clauses or filter widgets.
Parameters
| Parameter | Type | Default value |
|---|---|---|
alsoUnselectLinks | boolean | true |
Returns
void
Implementation of
selectLinks()
selectLinks(
linkIndices,addToSelection,selectEndpoints):void
Replace, or with addToSelection: true extend, the user link selection.
addToSelection: false (replace) clears BOTH user-selection Sets first — same clean-restart
semantics as selectPoints. addToSelection: true only adds to the link side. With
selectEndpoints: true, also extends the point selection with each link’s endpoints.
Pass null for a user-selection reset. For a full reset including Mosaic widget
clauses, use resetSelection instead:
selectLinks(null)/selectLinks([])— clears both user-selection Sets (default). Alias for unselectAll.addToSelectionis ignored fornull;selectLinks([], true, _)is a no-op.selectLinks(null, _, false)/selectLinks([], _, false)— clears the link user selection only. Alias forunselectAllLinks(false).
Parameters
| Parameter | Type | Default value |
|---|---|---|
linkIndices | number[] | null | undefined |
addToSelection | boolean | false |
selectEndpoints | boolean | true |
Returns
void
Implementation of
selectLink()
selectLink(
linkIndex,addToSelection,selectEndpoints):void
Selects a single link. Delegates to selectLinks. addToSelection: false clears
both user-selection Sets first (clean restart); addToSelection: true adds to current.
With selectEndpoints: true, also adds the link’s two endpoint points additively.
Pass null to reset user selection — same semantics as selectLinks(null, …).
Parameters
| Parameter | Type | Default value |
|---|---|---|
linkIndex | number | null | undefined |
addToSelection | boolean | false |
selectEndpoints | boolean | true |
Returns
void
Implementation of
unselectLink()
unselectLink(
linkIndex?,unselectEndpoints?):void
Removes a single link from the link selection. Default (true) also removes the link’s
endpoints AND every other link incident to those endpoints. Pass false for single mode.
Canvas click handlers pass the config-driven value explicitly.
Parameters
| Parameter | Type | Default value |
|---|---|---|
linkIndex? | number | undefined |
unselectEndpoints? | boolean | true |
Returns
void
Implementation of
unselectLinks()
unselectLinks(
indicesToRemove,unselectEndpoints):void
Removes the given links from the current user link selection. With
unselectEndpoints: true, also removes each link’s endpoints AND every other link
incident to those endpoints (no danglers left behind). Symmetric naming with
selectLinks.
Parameters
| Parameter | Type | Default value |
|---|---|---|
indicesToRemove | number[] | undefined |
unselectEndpoints | boolean | true |
Returns
void
Implementation of
unselectAllLinks()
unselectAllLinks(
alsoUnselectPoints):void
Clears the link user selection. Default (true) also clears the point user selection and
drops the focused point — alias for unselectAll. Pass false for link side only.
Does NOT touch Mosaic clauses or filter widgets.
Parameters
| Parameter | Type | Default value |
|---|---|---|
alsoUnselectPoints | boolean | true |
Returns
void
Implementation of
unselectAll()
unselectAll():
void
Clear both user-selection Sets (the “user selection” channel). Drops the focused point
(a point-side concept). Does NOT touch Mosaic clauses on pointsSelection /
linksSelection (filter widgets stay active). For a full reset that also clears widgets,
use resetSelection.
Returns
void
Implementation of
resetSelection()
resetSelection():
void
Full reset across both selection channels: clears user-selection Sets, drops the focused
point, AND dispatches resetSelections so filter widgets (histograms, bars, search,
timeline) drop their Mosaic clauses. Use when you want the canvas to return to the
default “no input active” state.
Returns
void
Implementation of
setFocusedPoint()
setFocusedPoint(
index?):void
Sets focus on a point by index. Draws a ring around the focused point.
Parameters
| Parameter | Type | Description |
|---|---|---|
index? | number | Index of the point to be focused. |
Returns
void
Remarks
If focusedPointIndex is set, it will have priority over this method.
Implementation of
setPinnedPoints()
setPinnedPoints(
indices):void
Sets which points are pinned (fixed) in position.
Pinned points:
- Do not move due to physics forces (gravity, repulsion, link forces, etc.)
- Still participate in force calculations (other nodes are attracted to/repelled by them)
- Can still be dragged by the user if
enableDragis true
Parameters
| Parameter | Type | Description |
|---|---|---|
indices | number[] | Array of point indices to pin. Set to [] or null to unpin all points. |
Returns
void
Example
// Pin points 0 and 5
graph.setPinnedPoints([0, 5])
// Unpin all points
graph.setPinnedPoints([])
graph.setPinnedPoints(null)Implementation of
start()
start(
alpha?):void
Starts the simulation.
Parameters
| Parameter | Type | Description |
|---|---|---|
alpha? | number | Value between 0 and 1. The higher the value, the more energy the simulation gets. |
Returns
void
Implementation of
pause()
pause():
void
Pauses the simulation.
Returns
void
Implementation of
unpause()
unpause():
void
Unpauses the simulation.
Returns
void
Implementation of
stop()
stop():
void
Stops the simulation.
Returns
void
Implementation of
step()
step():
void
Renders only one frame of the simulation (stops the simulation if it was running).
Returns
void
Implementation of
setZoomLevel()
setZoomLevel(
value,duration):void
Zooms the view in or out to the specified zoom level.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
value | number | undefined | Zoom level. |
duration | number | 0 | Duration of the zoom transition. |
Returns
void
Implementation of
getZoomLevel()
getZoomLevel():
number|undefined
Gets the zoom level of the view.
Returns
number | undefined
Zoom level value.
Implementation of
setZoomTransformByPointPositions()
setZoomTransformByPointPositions(
pointPositions,duration?,scale?,padding?):void
Sets the zoom transform so that the given point positions fit in the viewport, with optional animation.
Parameters
| Parameter | Type | Description |
|---|---|---|
pointPositions | Float32Array | - |
duration? | number | Animation duration in milliseconds. Default 250. |
scale? | number | Optional scale factor; if omitted, scale is chosen to fit the positions. |
padding? | number | Padding around the viewport as a fraction (e.g. 0.1 = 10%). Default 0.1. |
Returns
void
Implementation of
ICosmograph.setZoomTransformByPointPositions
zoomToPoint()
zoomToPoint(
index,duration,scale?,canZoomOut?):void
Centers the view and zooms in to a point by its index.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | Point index to be zoomed in. |
duration | number | undefined | Optional duration in milliseconds. |
scale? | number | Optional zoom level. |
canZoomOut? | boolean | Optional parameter determining whether the view can zoom out. |
Returns
void
Implementation of
fitView()
fitView(
duration,padding):void
Centers and zooms the view to fit all points in the scene.
Parameters
| Parameter | Type | Description |
|---|---|---|
duration | number | undefined | Duration of the animation (default: 250ms). |
padding | number | undefined | Padding around the viewport (0 to 1 as 100% of the viewport, default 0.1. |
Returns
void
Remarks
During an active position transition the camera fits the target layout, not the interpolated positions currently on screen.
Implementation of
fitViewByIndices()
fitViewByIndices(
indices,duration,padding):void
Centers and zooms the viewport to fit points based on their indices.
Parameters
| Parameter | Type | Description |
|---|---|---|
indices | number[] | Array of point indices. |
duration | number | undefined | Duration of the animation (default: 250ms). |
padding | number | undefined | Padding around the viewport (0 to 1 as 100% of the viewport, default 0.1. |
Returns
void
Remarks
During an active position transition the camera fits the target layout, not the interpolated positions currently on screen.
Implementation of
fitViewByCoordinates()
fitViewByCoordinates(
coordinates,duration,padding):void
Fits the given coordinates into the viewport.
Parameters
| Parameter | Type | Description |
|---|---|---|
coordinates | number[] | Array of coordinates in the format [x0, y0, x1, y1, …]. |
duration | number | undefined | Duration of the animation (default: 250ms). |
padding | number | undefined | Padding around the viewport (0 to 1 as 100% of the viewport, default 0.1). |
Returns
void
Remarks
During an active position transition the camera fits the supplied coordinates directly; ongoing point animations may finish at a layout that no longer matches the framed view.
Implementation of
ICosmograph.fitViewByCoordinates
getConnectedPointIndices()
getConnectedPointIndices(
index):number[] |undefined
Gets the indices of the points that are connected to the point with the given index.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | The index of the point to get the connected points for. |
Returns
number[] | undefined
An array of indices of the connected points, or undefined if the point index is invalid or there are no connected points.
Deprecated
Prefer getNeighboringPointIndices.
Implementation of
ICosmograph.getConnectedPointIndices
getNeighboringPointIndices()
getNeighboringPointIndices(
pointIndices):number[] |undefined
Returns each input point’s neighbors — points connected by a link in either direction. Results are deduplicated when multiple inputs share neighbors.
Parameters
| Parameter | Type | Description |
|---|---|---|
pointIndices | number | number[] | A single point index or an array of indices. |
Returns
number[] | undefined
Array of neighboring point indices, or undefined if the graph is not initialized.
Implementation of
ICosmograph.getNeighboringPointIndices
getConnectedLinkIndices()
getConnectedLinkIndices(
pointIndices):number[] |undefined
Returns link indices where both endpoints are within the provided point set.
Parameters
| Parameter | Type | Description |
|---|---|---|
pointIndices | number | number[] | A single point index or an array of point indices. |
Returns
number[] | undefined
Deduplicated array of link indices, or undefined if the graph is not initialized.
Implementation of
ICosmograph.getConnectedLinkIndices
findPointsInRect()
findPointsInRect(
rect):number[] |undefined
Find point indices inside a rectangular area. Coordinates are canvas-relative pixels.
Parameters
| Parameter | Type | Description |
|---|---|---|
rect | [[number, number], [number, number]] | Two opposite corners of the rectangle: [[left, top], [right, bottom]]. |
Returns
number[] | undefined
Array of point indices inside the rectangle, or undefined if the graph is not initialized.
Implementation of
findPointsInPolygon()
findPointsInPolygon(
polygonPath):number[] |undefined
Find point indices inside a polygon area. Coordinates are canvas-relative pixels.
Parameters
| Parameter | Type | Description |
|---|---|---|
polygonPath | [number, number][] | Array of points defining the polygon [[x1, y1], [x2, y2], ..., [xn, yn]]. |
Returns
number[] | undefined
Array of point indices inside the polygon, or undefined if the graph is not initialized.
Implementation of
ICosmograph.findPointsInPolygon
getPointDegrees()
getPointDegrees(
index): {inDegree:number;outDegree:number; } |undefined
Gets the in-degree and out-degree (link counts) for the point with the given index.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | The index of the point to get the degrees for. |
Returns
{ inDegree: number; outDegree: number; } | undefined
An object containing the in-degree (incoming links) and out-degree (outgoing links) for the point,
or undefined if the cosmograph instance is not initialized or the point index is invalid.
Implementation of
getCameraState()
getCameraState():
Camera3dState|undefined
Returns
Camera3dState | undefined
Implementation of
setCameraState()
setCameraState(
state,duration?):void
Parameters
| Parameter | Type |
|---|---|
state | Partial<Camera3dState> |
duration? | number |
Returns
void
Implementation of
spaceToScreenPosition()
Call Signature
spaceToScreenPosition(
spacePosition,options?): [number,number] |undefined
Converts the X and Y point coordinates from the space coordinate system to the screen coordinate system.
Parameters
| Parameter | Type | Description |
|---|---|---|
spacePosition | [number, number] | Array of x and y coordinates in the space coordinate system. |
options? | PositionDimensionsOptions | - |
Returns
[number, number] | undefined
Array of x and y coordinates in the screen coordinate system.
Implementation of
ICosmograph.spaceToScreenPosition
Call Signature
spaceToScreenPosition(
spacePosition,options): [number,number] |undefined
Parameters
| Parameter | Type |
|---|---|
spacePosition | [number, number, number] |
options | PositionDimensionsOptions & object |
Returns
[number, number] | undefined
Implementation of
ICosmograph.spaceToScreenPosition
screenToSpacePosition()
Call Signature
screenToSpacePosition(
screenPosition,options?): [number,number] |undefined
Converts the X and Y point coordinates from the screen coordinate system to the space coordinate system.
Parameters
| Parameter | Type | Description |
|---|---|---|
screenPosition | [number, number] | Array of x and y coordinates in the screen coordinate system. |
options? | PositionDimensionsOptions & object | - |
Returns
[number, number] | undefined
Array of x and y coordinates in the space coordinate system.
Implementation of
ICosmograph.screenToSpacePosition
Call Signature
screenToSpacePosition(
screenPosition,options): [number,number,number] |undefined
Parameters
| Parameter | Type |
|---|---|
screenPosition | [number, number] |
options | PositionDimensionsOptions & object |
Returns
[number, number, number] | undefined
Implementation of
ICosmograph.screenToSpacePosition
spaceToScreenRadius()
spaceToScreenRadius(
spaceRadius):number|undefined
Converts the point radius value from the space coordinate system to the screen coordinate system.
Parameters
| Parameter | Type | Description |
|---|---|---|
spaceRadius | number | Radius of the point in the space coordinate system. |
Returns
number | undefined
Radius of the point in the screen coordinate system.
Implementation of
ICosmograph.spaceToScreenRadius
getPointRadiusByIndex()
getPointRadiusByIndex(
index):number|undefined
Get point space radius by its index.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | Index of the point. |
Returns
number | undefined
Radius of the point in the space coordinate system.
Implementation of
ICosmograph.getPointRadiusByIndex
getPointScreenRadiusByIndex()
getPointScreenRadiusByIndex(
index,pointPosition?):number
Get point screen radius by its index.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | Index of the point. |
pointPosition? | [number, number, number] | - |
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
| Parameter | Type | Description |
|---|---|---|
indices | number[] | Array of point indices. |
Returns
void
See
- getTrackedPointPositionsArray to get tracked positions as a flattened array
- getTrackedPointPositionsMap to get tracked positions as a Map
Implementation of
ICosmograph.trackPointPositionsByIndices
getTrackedPointPositionsArray()
getTrackedPointPositionsArray(
options?):number[] |undefined
Gets an array of point positions that are currently tracked by the renderer. Use trackPointPositionsByIndices to specify which points to track.
Parameters
| Parameter | Type |
|---|---|
options? | PositionDimensionsOptions |
Returns
number[] | undefined
A flattened array of point positions [x0, y0, x1, y1, ...] for tracked points, or undefined if not available.
See
- trackPointPositionsByIndices to set which points to track
- getTrackedPointPositionsMap for a more convenient Map-based format
Implementation of
ICosmograph.getTrackedPointPositionsArray
getTrackedPointPositionsMap()
Call Signature
getTrackedPointPositionsMap(
options?):ReadonlyMap<number, [number,number]> |undefined
Gets a Map of point positions that are currently tracked by the renderer. Use trackPointPositionsByIndices to specify which points to track.
Parameters
| Parameter | Type |
|---|---|
options? | PositionDimensionsOptions & object |
Returns
ReadonlyMap<number, [number, number]> | undefined
A Map where keys are point indices and values are their corresponding X, Y coordinates, or undefined if not available.
See
- trackPointPositionsByIndices to set which points to track
- getTrackedPointPositionsArray for a flattened array format
Implementation of
ICosmograph.getTrackedPointPositionsMap
Call Signature
getTrackedPointPositionsMap(
options):ReadonlyMap<number, [number,number,number]> |undefined
Parameters
| Parameter | Type |
|---|---|
options | PositionDimensionsOptions & object |
Returns
ReadonlyMap<number, [number, number, number]> | undefined
Implementation of
ICosmograph.getTrackedPointPositionsMap
getSampledPoints()
getSampledPoints(
options?): {indices:number[];positions:number[]; } |undefined
Retrieves sampled point data as arrays with indices and positions.
Parameters
| Parameter | Type |
|---|---|
options? | PositionDimensionsOptions |
Returns
{ indices: number[]; positions: number[]; } | undefined
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
getSampledLinks()
getSampledLinks(
options?): {indices:number[];positions:number[];angles:number[]; } |undefined
For the links that are currently visible on the screen, get a sample of link indices, midpoint positions, and angles.
The resulting number of links will depend on the linkSamplingDistance configuration property,
and the sampled links will be evenly distributed.
Positions are in data space; angles are in radians for screen-space rotation (0 = right, positive = clockwise, e.g. for CSS rotation).
Parameters
| Parameter | Type |
|---|---|
options? | PositionDimensionsOptions |
Returns
{ indices: number[]; positions: number[]; angles: number[]; } | undefined
Implementation of
getSampledPointPositionsMap()
Call Signature
getSampledPointPositionsMap(
options?):Map<number, [number,number]> |undefined
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.
Parameters
| Parameter | Type |
|---|---|
options? | PositionDimensionsOptions & object |
Returns
Map<number, [number, number]> | undefined
A Map where keys are the ids of the points and values are their corresponding X and Y coordinates.
Implementation of
ICosmograph.getSampledPointPositionsMap
Call Signature
getSampledPointPositionsMap(
options):Map<number, [number,number,number]> |undefined
Parameters
| Parameter | Type |
|---|---|
options | PositionDimensionsOptions & object |
Returns
Map<number, [number, number, number]> | undefined
Implementation of
ICosmograph.getSampledPointPositionsMap
getSampledLinkPositionsMap()
Call Signature
getSampledLinkPositionsMap(
options?):Map<number, [number,number,number]> |undefined
For the links that are currently visible on the screen, get a sample of link indices with their midpoint coordinates and angle.
The resulting number of links will depend on the linkSamplingDistance configuration property,
and the sampled links will be evenly distributed (one link per grid cell, based on link midpoint in screen space).
Each value is [x, y, angle]: position in data space; angle in radians for screen-space rotation (0 = right, positive = clockwise, e.g. for CSS rotation).
Parameters
| Parameter | Type |
|---|---|
options? | PositionDimensionsOptions & object |
Returns
Map<number, [number, number, number]> | undefined
Implementation of
ICosmograph.getSampledLinkPositionsMap
Call Signature
getSampledLinkPositionsMap(
options):Map<number, [number,number,number,number]> |undefined
Parameters
| Parameter | Type |
|---|---|
options | PositionDimensionsOptions & object |
Returns
Map<number, [number, number, number, number]> | undefined
Implementation of
ICosmograph.getSampledLinkPositionsMap
getActiveSelectionSourceId()
getActiveSelectionSourceId():
string|undefined
Gets the id of the filter widget that last drove the points crossfilter.
Returns
string | undefined
The id of the active filter widget, or undefined if no filter is active.
Implementation of
ICosmograph.getActiveSelectionSourceId
getPointIndicesByIds()
getPointIndicesByIds(
ids):Promise<number[] |undefined>
Returns an array of point indices in the order they were sent to getPointIndicesByIds.
Parameters
| Parameter | Type | Description |
|---|---|---|
ids | string[] | Array of point ids. |
Returns
Promise<number[] | undefined>
A Promise resolving to an array of point indices.
Implementation of
ICosmograph.getPointIndicesByIds
getPointIdsByIndices()
getPointIdsByIndices(
indices):Promise<string[] |undefined>
Returns an array of point ids in the order they were sent to getPointIdsByIndices.
Parameters
| Parameter | Type | Description |
|---|---|---|
indices | number[] | Array of point indices. |
Returns
Promise<string[] | undefined>
A Promise resolving to an array of point ids.
Implementation of
ICosmograph.getPointIdsByIndices
getPointsByIndices()
getPointsByIndices(
indices):Promise<CosmographData|undefined>
Returns points entries as a CosmographData table by their indices.
Parameters
| Parameter | Type | Description |
|---|---|---|
indices | number[] | Array of point indices. |
Returns
Promise<CosmographData | undefined>
A Promise resolving to a CosmographData table of points.
Implementation of
ICosmograph.getPointsByIndices
getPointIndicesByExactValues()
getPointIndicesByExactValues(
column,values):Promise<number[] |undefined>
Returns an array of point indices that match the provided values in a column.
Parameters
| Parameter | Type | Description |
|---|---|---|
column | string | The column to filter by. |
values | (string | number)[] | The values to match in the specified column. |
Returns
Promise<number[] | undefined>
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<number[] |undefined>
Returns an array of point indices that match the provided numeric value in the specified column.
Parameters
| Parameter | Type | Description |
|---|---|---|
column | string | The column in the points table to filter by. |
value | string | number | The numeric value to match in the specified column. |
isMax | boolean | Indicates whether to return the indices for the maximum or minimum value. |
Returns
Promise<number[] | undefined>
A Promise resolving to an array of point indices, or undefined if the operation fails.
Implementation of
ICosmograph.getPointIndicesByNumericValue
getPointIndicesByLinksExactValues()
getPointIndicesByLinksExactValues(
column,values):Promise<number[] |undefined>
Returns an array of point indices that match the provided link column values.
Parameters
| Parameter | Type | Description |
|---|---|---|
column | string | The column in the links table to filter by. |
values | (string | number)[] | The values to match in the specified column. |
Returns
Promise<number[] | undefined>
A Promise resolving to an array of point indices.
Implementation of
ICosmograph.getPointIndicesByLinksExactValues
getPointIndicesByLinksNumericValue()
getPointIndicesByLinksNumericValue(
column,value,isMax):Promise<number[] |undefined>
Returns an array of point indices that match the provided link column numeric value.
Parameters
| Parameter | Type | Description |
|---|---|---|
column | string | The column in the links table to filter by. |
value | string | number | The numeric value to match in the specified column. |
isMax | boolean | Indicates whether to return the indices for the maximum or minimum value. |
Returns
Promise<number[] | undefined>
A Promise resolving to an array of point indices.
Implementation of
ICosmograph.getPointIndicesByLinksNumericValue
getLinksByPointIds()
getLinksByPointIds(
ids):Promise<CosmographData|undefined>
Returns links entries as a CosmographData table where the source or target point id is in the provided array.
Parameters
| Parameter | Type | Description |
|---|---|---|
ids | string[] | Array of point ids. |
Returns
Promise<CosmographData | undefined>
A Promise resolving to a CosmographData table of links.
Implementation of
ICosmograph.getLinksByPointIds
getLinksByPointIndices()
getLinksByPointIndices(
indices):Promise<CosmographData|undefined>
Returns links entries as a CosmographData table where the source or target point index is in the provided array.
Parameters
| Parameter | Type | Description |
|---|---|---|
indices | number[] | Array of point indices. |
Returns
Promise<CosmographData | undefined>
A Promise resolving to a CosmographData table of links.
Implementation of
ICosmograph.getLinksByPointIndices
getLinksData()
getLinksData():
Promise<CosmographData|undefined>
Returns all links entries as a CosmographData table.
Returns
Promise<CosmographData | undefined>
A Promise resolving to a CosmographData table of links.
Implementation of
getPointsSummary()
getPointsSummary(
force):Promise<Record<string,unknown>[] |undefined>
Parameters
| Parameter | Type | Default value |
|---|---|---|
force | boolean | false |
Returns
Promise<Record<string, unknown>[] | undefined>
Implementation of
getLinksSummary()
getLinksSummary(
force):Promise<Record<string,unknown>[] |undefined>
Parameters
| Parameter | Type | Default value |
|---|---|---|
force | boolean | false |
Returns
Promise<Record<string, unknown>[] | undefined>
Implementation of
getSummary()
getSummary(
force):Promise<CosmographSummary>
Parameters
| Parameter | Type | Default value |
|---|---|---|
force | boolean | false |
Returns
Promise<CosmographSummary>
Implementation of
getPointsData()
getPointsData():
Promise<CosmographData|undefined>
Returns all points entries as a CosmographData table.
Returns
Promise<CosmographData | undefined>
A Promise resolving to a CosmographData table of points.
Implementation of
searchPoints()
searchPoints(
input,options):Promise<CosmographSearchResult>
Searches point data across the requested fields.
Each searched field value is converted to a string before matching, so this method can search text, numeric, boolean, date, and other scalar columns. By default, matching is case-insensitive and checks whether the query occurs anywhere in a field value.
The returned rows are limited to 100 by default. Use limit and offset for
pagination, returnFields to return only specific columns, and totalCount to display
the complete number of matching points before pagination.
This method does not update the graph selection.
Parameters
| Parameter | Type | Description |
|---|---|---|
input | string | Search query. |
options | CosmographSearchOptions | Search behavior, fields, pagination, and returned columns. |
Returns
Promise<CosmographSearchResult>
Matching point rows and the total number of matches before pagination.
Example
const result = await cosmograph.searchPoints('bike', {
fields: ['label', 'topic'],
returnFields: ['idx', 'label', 'topic'],
limit: 50,
})
console.log(result.rows)
console.log(result.totalCount)Implementation of
getPointIndicesBySearch()
getPointIndicesBySearch(
input,options):Promise<number[]>
Returns point indices matching a search query.
Matching follows the same rules as searchPoints, but the query returns point indices only. This is more efficient when the caller wants to select, filter, or fit the view to all matching points without loading complete rows.
Unlike searchPoints, this method has no default
limit, so it returns every matching point index unless limit is explicitly provided.
The returnFields option is ignored.
This method does not update the graph selection. Pass the result to selectPoints
when selection is desired.
Parameters
| Parameter | Type | Description |
|---|---|---|
input | string | Search query. |
options | CosmographSearchOptions | Search options. The default limit is undefined, returning all matching point indices. |
Returns
Promise<number[]>
Matching point indices.
Example
const indices = await cosmograph.getPointIndicesBySearch('bike', {
fields: ['label', 'topic'],
})
cosmograph.selectPoints(indices)
cosmograph.fitViewByIndices(indices)Implementation of
ICosmograph.getPointIndicesBySearch
convertCosmographDataToObject()
convertCosmographDataToObject(
data):Record<string,unknown>[]
Converts a CosmographData table to an array of objects.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | CosmographData | CosmographData table. |
Returns
Record<string, unknown>[]
An array of objects.
Implementation of
ICosmograph.convertCosmographDataToObject
flattenPositions()
flattenPositions(
positions):number[] |undefined
Converts an array of tuple positions to a single flattened array containing all coordinates sequentially.
Parameters
| Parameter | Type | Description |
|---|---|---|
positions | [number, number][] | An array of tuple positions. |
Returns
number[] | undefined
A flattened array of coordinates.
Implementation of
pair()
pair(
pointPositions): [number,number][] |undefined
Converts a flat array of point positions to tuple pairs representing coordinates.
Parameters
| Parameter | Type | Description |
|---|---|---|
pointPositions | number[] | A flattened array of coordinates. |
Returns
[number, number][] | undefined
An array of tuple positions.
Implementation of
addPoints()
addPoints(
points):Promise<void>
Adds points to the Cosmograph instance.
Parameters
| Parameter | Type | Description |
|---|---|---|
points | CosmographPointInput[] | 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
addLinks()
addLinks(
links):Promise<void>
Adds links to the Cosmograph instance.
Parameters
| Parameter | Type | Description |
|---|---|---|
links | CosmographLinkInput[] | 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
removePointsByIndices()
removePointsByIndices(
indices,removeAttachedLinks):Promise<void>
Removes points from the Cosmograph instance by their indices.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
indices | number[] | undefined | The indices of the points to remove. |
removeAttachedLinks | boolean | true | Whether 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
| Parameter | Type | Description |
|---|---|---|
ids | string[] | The IDs of the points to remove. |
Returns
Promise<void>
A promise that resolves when the points have been removed.
Implementation of
removeLinksByPointIdPairs()
removeLinksByPointIdPairs(
pairs):Promise<void>
Removes links from the Cosmograph instance by their point ID pairs.
Parameters
| Parameter | Type | Description |
|---|---|---|
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
| Parameter | Type | Description |
|---|---|---|
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
addMosaicComponent()
addMosaicComponent(
component,container,config?):Promise<MosaicVgplotComponent|undefined>
Adds a custom Mosaic component (vgplot, spec, etc.) and mounts it to a container. The component will automatically participate in Cosmograph’s crossfilter system.
Parameters
| Parameter | Type | Description |
|---|---|---|
component | HTMLElement | The vgplot component |
container | HTMLElement | The DOM element to mount the component into |
config? | { id?: string; } | Optional configuration for the component |
config.id? | string | - |
Returns
Promise<MosaicVgplotComponent | undefined>
A promise that resolves to the created component
Implementation of
ICosmograph.addMosaicComponent
removeMosaicComponent()
removeMosaicComponent(
id):Promise<boolean>
Removes a custom Mosaic component by its ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The ID of the component to remove |
Returns
Promise<boolean>
A promise that resolves to true if the component was removed, false otherwise
Implementation of
ICosmograph.removeMosaicComponent
getMosaicComponents()
getMosaicComponents():
ReadonlyMap<string,MosaicVgplotComponent> |undefined
Gets all registered Mosaic components.
Returns
ReadonlyMap<string, MosaicVgplotComponent> | undefined
A readonly map of component IDs to components
Implementation of
ICosmograph.getMosaicComponents
reset()
reset(
total):Promise<void>
Resets the Cosmograph instance to its initial state.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
total | boolean | true | If true, resets configuration and displays the message div. |
Returns
Promise<void>
A promise that resolves when the reset operation is complete.
Implementation of
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.