Interface: CosmographDataPrepLinksConfig
Represents the configuration options for preparing links data for the Cosmograph.
Extends
Omit<CosmographLinksConfig,"links"|"linkTargetBy"|"linkSourceIndexBy"|"linkTargetIndexBy">.Pick<GraphConfigInterface,"linkDefaultColor"|"linkGreyoutOpacity"|"linkDefaultWidth"|"linkWidthScale">
Properties
linkSourceBy?
optionallinkSourceBy:string
The column name for the source point of each link. This should match the pointIdBy values in the points data.
Inherited from
CosmographLinksConfig.linkSourceBy
linkColorBy?
optionallinkColorBy:string
The column name for the link color.
If provided, links 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
CosmographLinksConfig.linkColorBy
linkColorByFn?
optionallinkColorByFn:ColorAccessorFn<number> |ColorAccessorFn<string> |ColorAccessorFn<boolean> |ColorAccessorFn<unknown>
Specifies the function that will be used to generate the color for each link based on the value in the linkColorBy column.
It takes a link record as input and its index, and should return a color string or an array of [r, g, b, a] values.
Works only when linkColorBy is provided. Overrides the values in linkColorBy column by processing them (in this case the values in the linkColorBy column can be of any type, not just colors).
Param
The value from the LinkColor column.
Param
The index of the link.
Returns
The color as a string or an array of [r, g, b, a] value to be applied to the link.
Inherited from
CosmographLinksConfig.linkColorByFn
linkColorPalette?
optionallinkColorPalette:string[]
An optional array of color strings that can be used to color the links in the visualization. If provided, the links will be colored using the colors in this palette, cycling through the array as needed.
Used when linkColorStrategy is set to 'categorical', 'count', 'sum', or 'average'`
Inherited from
CosmographLinksConfig.linkColorPalette
linkColorStrategy?
optionallinkColorStrategy:"count"|"categorical"|"direct"|"single"|"sum"|"average"
Specifies the strategy for coloring links based on data from the linkColorBy column.
When undefined (default), will automatically use the optimal strategy based on the input configuration and color data type.
Current strategy can be acquired with Cosmograph.activeLinkColorStrategy getter.
See LinkColorStrategy for available strategies and their documentation.
Inherited from
CosmographLinksConfig.linkColorStrategy
linkWidthBy?
optionallinkWidthBy:string
The column name for the link width.
If provided, links will have their widths set based on the values in this column, which should be numeric values.
Inherited from
CosmographLinksConfig.linkWidthBy
linkWidthByFn?
optionallinkWidthByFn:SizeAccessorFn<number> |SizeAccessorFn<string> |SizeAccessorFn<boolean> |SizeAccessorFn<unknown>
Specifies the function that will be used to generate the width for each link based on the value in the linkWidthBy column. It takes a link record as input and its index, and should return a numeric value.
Works only when linkWidthBy is provided. Overrides the values in the linkWidthBy column by processing them (in this case the values in the linkWidthBy column can be of any type, not just numbers).
Param
The value from the linkWidthBy column.
Param
The index of the link.
Returns
The numeric width value to be applied to the link.
Inherited from
CosmographLinksConfig.linkWidthByFn
linkWidthStrategy?
optionallinkWidthStrategy:"count"|"direct"|"single"|"sum"|"average"
Specifies the strategy for sizing links based on data from the linkWidthBy column.
When undefined (default), will automatically use the optimal strategy based on the input configuration and width data type.
Current strategy can be acquired with Cosmograph.activeLinkWidthStrategy getter.
See LinkWidthStrategy for available strategies and their documentation.
Inherited from
CosmographLinksConfig.linkWidthStrategy
linkWidthRange?
optionallinkWidthRange: [number,number]
Defines the range for automatic link width scaling. Takes [min, max] values in pixels.
When linkWidthBy column contains numeric values, they will be automatically remapped to fit within this range to prevent oversized links if no linkWidthByFn provided.
Note: Only works when linkWidthBy column is provided and contains numeric values and when linkWidthByFn is not set.
Default
[1, 9]Inherited from
CosmographLinksConfig.linkWidthRange
linkArrowBy?
optionallinkArrowBy:string
The column name that determines whether a link should have an arrow.
If provided, links will have arrows based on the boolean values in this column.
Inherited from
CosmographLinksConfig.linkArrowBy
linkArrowByFn?
optionallinkArrowByFn:BooleanAccessorFn<string> |BooleanAccessorFn<number> |BooleanAccessorFn<unknown>
Specifies the function that determines if a link should have an arrow based on the value in the linkArrowBy column. It takes a link record as input and its index, and should return a boolean value.
Works only when linkArrowBy is provided. Overrides the values in the linkArrowBy column by processing them (in this case the values in the linkArrowBy column can be of any type, not just booleans).
Param
The value from the linkArrowBy column.
Param
The index of the link.
Returns
A boolean indicating whether the link should have an arrow.
Inherited from
CosmographLinksConfig.linkArrowByFn
linkStrengthBy?
optionallinkStrengthBy:string
The column name for the link strength. If provided, links will have their strengths set based on the values in this column, which should be numeric values. Link strength affects the force simulation.
Inherited from
CosmographLinksConfig.linkStrengthBy
linkStrengthByFn?
optionallinkStrengthByFn:SizeAccessorFn<number> |SizeAccessorFn<string> |SizeAccessorFn<boolean> |SizeAccessorFn<unknown>
Specifies the function that will be used to generate the strength for each link based on the value in the linkStrengthBy column. It takes a link record as input and its index, and should return a numeric value.
Works only when linkStrengthBy is provided. Overrides the values in the linkStrengthBy column by processing them (in this case the values in the linkStrengthBy column can be of any type, not just numbers).
Param
The value from the LinkStrength column.
Param
The index of the link.
Returns
The numeric strength value to be applied to the link.
Inherited from
CosmographLinksConfig.linkStrengthByFn
linkStrengthRange?
optionallinkStrengthRange: [number,number]
Defines the range for automatic link strength scaling. Takes [min, max] values in the range [0, 1].
This setting can be used to control the strength of the links during the simulation.
Note: Only works when linkStrengthBy column is provided and contains numeric values and when linkStrengthByFn is not set. Has effect only during the active simulation.
Default
[0.2, 1.0]Inherited from
CosmographLinksConfig.linkStrengthRange
linkIncludeColumns?
optionallinkIncludeColumns:string[]
An array of additional column names to include in the link data.
These columns will be available on the link objects but not used by Cosmograph directly, can be used as accessors for Cosmograph components. Useful for storing additional information about the links.
Inherited from
CosmographLinksConfig.linkIncludeColumns
linkTargetsBy
linkTargetsBy:
string[]
The column names to use as the targets for links.
outputFilename?
optionaloutputFilename:string
The filename to use for the output links data. Has impact only when CosmographDataPrepConfig is passed into downloadCosmographData.
csvParseTimeFormat?
optionalcsvParseTimeFormat:string
The time format to use when parsing CSV data. Has impact only when source data is CSV.
csvColumnTypesMap?
optionalcsvColumnTypesMap:Record<string,string>
A mapping of column names to data types for CSV parsing. Has impact only when source data is CSV.
linkDefaultColor?
optionallinkDefaultColor:string| [number,number,number,number]
The default color to use for links when no link 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., ‘#666666’) 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: ‘#666666’
Inherited from
GraphConfigInterface.linkDefaultColor
linkGreyoutOpacity?
optionallinkGreyoutOpacity:number
Greyed out link opacity value when the selection is active.
Default value: 0.1
Inherited from
GraphConfigInterface.linkGreyoutOpacity
linkDefaultWidth?
optionallinkDefaultWidth:number
The default width value to use for links when no link widths are provided or if the width value in the array is undefined or null.
Default value: 1
Inherited from
GraphConfigInterface.linkDefaultWidth
linkWidthScale?
optionallinkWidthScale:number
Scale factor for the link width.
Default value: 1