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
crossfilter
Get Signature
get crossfilter():
Crossfilter
Gets the crossfilter sets for links, points, and their intersection.
Returns
An object containing the crossfiltered indices Sets.
Gets the crossfilter sets for links, points, and their intersection.
Implementation of
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
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
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
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
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
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
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
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
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
<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
Parameter | Type | Description |
---|---|---|
config? | CosmographConfig | Config to be applied to the Cosmograph. |
Returns
Promise
<void
>
Implementation of
captureScreenshot()
captureScreenshot(
fileName
):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ā). |
Returns
void
Implementation of
getPointPositions()
getPointPositions():
undefined
|number
[]
Gets the current X and Y coordinates of the points.
Returns
undefined
| number
[]
Array of point positions.
Implementation of
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
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
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
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
getPointPositionByIndex()
getPointPositionByIndex(
index
):undefined
| [number
,number
]
Gets the current X and Y coordinates of a point by its index.
Parameters
Parameter | Type | Description |
---|---|---|
index | number | Point 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
Parameter | Type | Default value | Description |
---|---|---|---|
selection | null | [[number , number ], [number , number ]] | undefined | Array of two corners of the rectangle [[left, top], [right, bottom]] . |
addToSelection | boolean | false | - |
Returns
void
Implementation of
ICosmograph
.selectPointsInRect
selectPointsInPolygon()
selectPointsInPolygon(
polygonPoints
,addToSelection
):void
Selects points inside a polygonal polygon.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
polygonPoints | [number , number ][] | undefined | - |
addToSelection | boolean | false | Optional parameter determining whether to add the points to the current selection. |
Returns
void
Implementation of
ICosmograph
.selectPointsInPolygon
unselectPointsInRect()
unselectPointsInRect(
selection
):void
Parameters
Parameter | Type |
---|---|
selection | null | [[number , number ], [number , number ]] |
Returns
void
unselectPointsInPolygon()
unselectPointsInPolygon(
polygonPoints
):void
Parameters
Parameter | Type |
---|---|
polygonPoints | [number , number ][] |
Returns
void
selectPoints()
selectPoints(
pointIndices
,addToSelection
):void
Selects points.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
pointIndices | null | number [] | undefined | Array of point indices to be selected. |
addToSelection | boolean | false | - |
Returns
void
Implementation of
selectPoint()
selectPoint(
pointIndexBy?
,addToSelection?
,selectConnectedPoints?
):void
Selects a point and, optionally, its connected points.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
pointIndexBy? | number | undefined | Selected point index. |
addToSelection? | boolean | false | Optional 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
unselectPoint()
unselectPoint(
pointIndexBy?
,unselectConnectedPoints?
):void
Unselects a point and, optionally, its connected points.
Parameters
Parameter | Type | Description |
---|---|---|
pointIndexBy? | number | Selected point index. |
unselectConnectedPoints? | boolean | Optional parameter determining whether to also unselect the connected points. |
Returns
void
Implementation of
unselectPointsByIndicies()
unselectPointsByIndicies(
indicesToRemove
):void
Unselects points by indices.
Parameters
Parameter | Type | Description |
---|---|---|
indicesToRemove | number [] | Array of point indices to be unselected. |
Returns
void
Implementation of
ICosmograph
.unselectPointsByIndicies
unselectAllPoints()
unselectAllPoints():
void
Unselects all points.
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
start()
start(
alpha
):void
Starts the simulation.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
alpha | number | 1 | 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
restart()
restart():
void
Restarts 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():
undefined
|number
Gets the zoom level of the view.
Returns
undefined
| number
Zoom level value.
Implementation of
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 | undefined | number | 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 | undefined | number | Duration of the animation (default: 250ms). |
padding | undefined | number | Padding around the viewport (0 to 1 as 100% of the viewport, default 0.1. |
Returns
void
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 | undefined | number | Duration of the animation (default: 250ms). |
padding | undefined | number | Padding around the viewport (0 to 1 as 100% of the viewport, default 0.1. |
Returns
void
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 | undefined | number | Duration of the animation (default: 250ms). |
padding | undefined | number | Padding 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
Parameter | Type | Description |
---|---|---|
index | number | The 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
Parameter | Type | Description |
---|---|---|
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
Parameter | Type | Description |
---|---|---|
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
Parameter | Type | Description |
---|---|---|
spaceRadius | number | Radius 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
Parameter | Type | Description |
---|---|---|
index | number | Index 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
Parameter | Type | Description |
---|---|---|
index | number | Index 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
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():
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
- trackPointPositionsByIndices to set which points to track
- getTrackedPointPositionsMap for a more convenient Map-based format
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
- trackPointPositionsByIndices to set which points to track
- getTrackedPointPositionsArray for a flattened array format
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
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
Parameter | Type | Description |
---|---|---|
ids | string [] | 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
Parameter | Type | Description |
---|---|---|
indices | number [] | 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
Parameter | Type | Description |
---|---|---|
indices | number [] | 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
Parameter | Type | Description |
---|---|---|
column | string | The 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
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
<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
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
<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
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
<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
Parameter | Type | Description |
---|---|---|
ids | string [] | 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
Parameter | Type | Description |
---|---|---|
indices | number [] | 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
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
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
):undefined
|number
[]
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
undefined
| number
[]
A flattened array of coordinates.
Implementation of
pair()
pair(
pointPositions
):undefined
| [number
,number
][]
Converts a flat array of point positions to tuple pairs representing coordinates.
Parameters
Parameter | Type | Description |
---|---|---|
pointPositions | number [] | A flattened array of coordinates. |
Returns
undefined
| [number
, number
][]
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
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.