Interface: CosmographDataPrepPointsConfig
Represents the configuration options for preparing points data for the Cosmograph.
Extends
Omit
<CosmographPointsConfig
,"points"
|"pointIndexBy"
>.Pick
<GraphConfigInterface
,"pointColor"
|"pointGreyoutOpacity"
|"pointSize"
|"pointSizeScale"
>
Properties
pointIdBy?
optional
pointIdBy:string
Unique identifier column for each point. Required for mapping links to points correctly.
Inherited from
Omit.pointIdBy
pointColorBy?
optional
pointColorBy:string
The column name for the point color. If provided, points will be colored based on the values in this column, which should be either a color string
or an array of numeric [r, g, b, a]
values.
Inherited from
Omit.pointColorBy
pointColorByFn?
optional
pointColorByFn:ColorAccessorFn
<number
> |ColorAccessorFn
<string
> |ColorAccessorFn
<boolean
> |ColorAccessorFn
<unknown
>
Specifies the function that will be used to generate the color for each point based on the value in the pointColorBy column. It takes a point record as input and its index, and should return a color string
or an array of [r, g, b, a]
values.
Overrides the values in pointColorBy column by processing them (in this case the values in the pointColorBy column can be of any type, not just colors).
Has effect only when pointColorBy is provided and pointColorStrategy is undefined
.
See
Returns
The color as a string
or an array of [r, g, b, a]
value to be applied to the point.
Example
// Color points based on a value of the `pointColorBy` column
pointColorByFn: (value: number) => value > 10 ? 'red' : '#00ff00'
// Color points based on the index of the point
pointColorByFn: (value: number, index: number) => index % 2 === 0 ? 'red' : '#00ff00'
// Color points using RGBA values
pointColorByFn: (value: unknown) => [255, 0, 0, 1]
Inherited from
Omit.pointColorByFn
pointColorPalette?
optional
pointColorPalette:string
[]
An optional array of color strings that can be used to color the points in the visualization. If provided, the points will be colored using the colors in this palette, cycling through the array as needed.
Used when pointColorStrategy is set to 'palette'
, 'interpolatePalette'
, or 'degree'
.`
Inherited from
Omit.pointColorPalette
pointColorByMap?
optional
pointColorByMap:Record
<string
,string
| [number
,number
,number
,number
]>
An optional mapping of values to colors for the points in the visualization. The keys in the map should be string and the values can be either color strings or arrays of RGBA values.
Used when pointColorStrategy is set to 'map'
.
Default
undefined
Example
pointColorByMap: {
'active': '#ff0000', // string key with hex color
'42': [255, 0, 0, 1], // number key with RGBA array
'true': 'red' // boolean key with css-valid color
}
Inherited from
Omit.pointColorByMap
pointColorStrategy?
optional
pointColorStrategy:string
Specifies the strategy for coloring points based on data from the pointColorBy column. Available strategies:
undefined
(default):
Will automatically use the optimal strategy based on the input configuration and color data type. Current strategy can be acquired with Cosmograph.activePointColorStrategy getter.
'palette'
Uses colors from pointColorPalette without interpolation.
- For numeric data: Creates equal-width buckets mapped to pointColorPalette colors
- For categorical data: Assigns colors from pointColorPalette in order, cycling when unique values exceed palette length
'interpolatePalette'
Interpolates colors from pointColorPalette.
- For numeric data: Creates continuous color scale between pointColorPalette colors
- For categorical data: Creates evenly-spaced color scale by interpolating between pointColorPalette colors to match the number of unique values in pointColorBy so every value is a unique color
'map'
Uses color mapping from pointColorByMap to values in pointColorBy.
- Applies exact color from pointColorByMap for matching values
- Falls back to pointColor when value is not found in map or invalid
'degree'
Colors points based on their degree (number of connections) using interpolated pointColorPalette with quantile-based boundaries.
- Maps point degrees to continuous color scale between pointColorPalette colors
- Has effect only if links provided
'direct'
Directly uses pointColorBy column values as colors.
- Applies the color if itâs a valid color string (hex, rgb, named color, etc) or an array of
[r, g, b, a]
- If pointColorByFn exists, applies it to transform pointColorBy values into custom colors with it
- Falls back to pointColor if invalid color
- If neither pointColorBy nor pointColorByFn exist, colors all points with pointColor
Inherited from
Omit.pointColorStrategy
pointSizeBy?
optional
pointSizeBy:string
The column name that should contain numeric values to be used for the point size and label weight (if labels enabled). If provided, points will be sized based on the values in this column.
Inherited from
Omit.pointSizeBy
pointSizeStrategy?
optional
pointSizeStrategy:string
Specifies the strategy for sizing points based on data from the pointSizeBy column. Available strategies:
undefined
(default):
Will automatically use the optimal strategy based on the input configuration and size data type. Current strategy can be acquired with Cosmograph.activePointSizeStrategy getter.
'auto'
Automatically sizes points using symmetric log scaling with quantile-based data boundaries based on the pointSizeBy data. Uses pointSizeRange to determine the min/max size range.
- Has effect only if pointSizeBy provided and contains numeric data.
direct
:
Directly uses pointSizeBy column values as point sizes.
- If pointSizeByFn exists, applies it to transform pointSizeBy values into custom sizes with it
- Falls back to pointSize if invalid size
- If neither pointSizeBy nor pointSizeByFn exist, sizes all points with pointSize
'degree'
Sizes points based on their degree (number of connections) with quantile-based boundaries and the min/max from pointSizeRange.
- Has effect only if links provided
Inherited from
Omit.pointSizeStrategy
pointSizeRange?
optional
pointSizeRange: [number
,number
]
Defines the range for automatic point size scaling. Takes [min, max] values in pixels.
When pointSizeBy column contains numeric values, they will be automatically remapped to fit within this range to prevent oversized points.
Used when pointSizeStrategy is set to 'auto'
or 'degree'
.
Default
[2, 9]
Inherited from
Omit.pointSizeRange
pointSizeByFn?
optional
pointSizeByFn:SizeAccessorFn
<number
> |SizeAccessorFn
<string
> |SizeAccessorFn
<boolean
> |SizeAccessorFn
<unknown
>
Function that generates sizes for points based on values in the pointSizeBy column.
Overrides the values in pointSizeBy column by processing them (values can be of any type, not just numbers).
Has effect only when pointSizeBy is provided and pointSizeStrategy is undefined
.
See
Example
// Size points based on a value of the `pointSizeBy` column
pointSizeByFn: (value: boolean) => value ? 8 : 4
// Size points based on the index
pointSizeByFn: (value: unknown, index: number) => index % 2 === 0 ? 8 : 4
// Size points using a calculation
pointSizeByFn: (value: number) => Math.min(value * 2, 10)
Inherited from
Omit.pointSizeByFn
pointClusterBy?
optional
pointClusterBy:string
Column name containing cluster assignments for points. Can be string or number.
Remarks
Cosmograph will automatically generate a mapping of cluster values to their indices that will be available in the clusterMapping getter.
Inherited from
Omit.pointClusterBy
pointClusterByFn()?
optional
pointClusterByFn: (value
,index?
) =>unknown
Function that generates cluster assignments for points based on values in the pointClusterBy column.
Overrides the values in pointClusterBy column by processing them.
Has effect only when pointClusterBy is provided.
Parameters
Parameter | Type |
---|---|
value | any |
index? | number |
Returns
unknown
Example
pointClusterByFn: (value: string) => value.length
Inherited from
Omit.pointClusterByFn
pointClusterStrengthBy?
optional
pointClusterStrengthBy:string
The pointClusterStrengthBy
column defines how strongly each point is attracted to its assigned cluster during the simulation.
The column should contain numeric values where higher values (closer to 1.0) = stronger attraction, point stays closer to its cluster, Lower values (closer to 0.0) = weaker attraction, point can move more freely away from its cluster
Has effect only when pointClusterBy is provided.
Inherited from
Omit.pointClusterStrengthBy
pointLabelBy?
optional
pointLabelBy:string
The column name for the point label.
Inherited from
Omit.pointLabelBy
pointLabelWeightBy?
optional
pointLabelWeightBy:string
Specify the numeric column that will be used for the point label weight. Higher weight values make labels more likely to be shown.
If not provided, the points labels will be sorted by pointSizeBy
if provided or their total links count (degree) otherwise .
Inherited from
Omit.pointLabelWeightBy
pointXBy?
optional
pointXBy:string
The column name for the pointâs x-coordinate.
If provided with pointYBy
, points will be positioned based on the values from pointXBy
and pointYBy
columns.
Inherited from
Omit.pointXBy
pointYBy?
optional
pointYBy:string
The column name for the pointâs y-coordinate.
If provided with pointXBy
, points will be positioned based on the values from pointXBy
and pointYBy
columns.
Inherited from
Omit.pointYBy
pointIncludeColumns?
optional
pointIncludeColumns:string
[]
An array of additional column names to include in the point data.
These columns will be available on the point objects but not used by Cosmograph directly, can be used as accessors for Cosmograph comopnents. Useful for storing additional information about the points.
Inherited from
Omit.pointIncludeColumns
linkSourceBy?
optional
linkSourceBy:string
The column name to use as the source for links.
linkTargetsBy?
optional
linkTargetsBy:string
[]
The column names to use as the targets for links.
outputFilename?
optional
outputFilename:string
The filename to use for the output points data. Has impact only when CosmographDataPrepConfig
is passed into downloadCosmographData.
csvParseTimeFormat?
optional
csvParseTimeFormat:string
The time format to use when parsing CSV data. Has impact only when source data is CSV.
csvColumnTypesMap?
optional
csvColumnTypesMap:Record
<string
,string
>
A mapping of column names to data types for CSV parsing. Has impact only when source data is CSV.
pointColor?
optional
pointColor:string
| [number
,number
,number
,number
]
The default color to use for points when no point colors are provided,
or if the color value in the array is undefined
or null
.
This can be either a hex color string (e.g., â#b3b3b3â) or an array of RGBA values
in the format [red, green, blue, alpha]
where each value is a number between 0 and 255.
Default value: â#b3b3b3â
Inherited from
Pick.pointColor
pointGreyoutOpacity?
optional
pointGreyoutOpacity:number
Opacity value for points when they are greyed out (when selection is active). Values range from 0 (completely transparent) to 1 (fully opaque).
If defined, this value will override the alpha/opacity component of pointGreyoutColor
.
Default value: undefined
Inherited from
Pick.pointGreyoutOpacity
pointSize?
optional
pointSize:number
The default size value to use for points when no point sizes are provided or
if the size value in the array is undefined
or null
.
Default value: 4
Inherited from
Pick.pointSize
pointSizeScale?
optional
pointSizeScale:number
Scale factor for the point size.
Default value: 1
Inherited from
Pick.pointSizeScale