JavaScript & React libraryAPI

Interface: CosmographDataPrepLinksConfig

Represents the configuration options for preparing links data for the Cosmograph.

Extends

Properties

linkSourceBy?

optional linkSourceBy: string

The column name for the source point of each link. This should match the pointIdBy values in the points data.

Inherited from

Omit.linkSourceBy


linkColorBy?

optional linkColorBy: 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

Omit.linkColorBy


linkColorByFn?

optional linkColorByFn: 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

Omit.linkColorByFn


linkWidthBy?

optional linkWidthBy: 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

Omit.linkWidthBy


linkWidthRange?

optional linkWidthRange: [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

Omit.linkWidthRange


linkWidthByFn?

optional linkWidthByFn: 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 LinkWidth column.

Param

The index of the link.

Returns

The numeric width value to be applied to the link.

Inherited from

Omit.linkWidthByFn


linkArrowBy?

optional linkArrowBy: 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

Omit.linkArrowBy


linkArrowByFn?

optional linkArrowByFn: 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 LinkArrow column.

Param

The index of the link.

Returns

A boolean indicating whether the link should have an arrow.

Inherited from

Omit.linkArrowByFn


linkStrengthBy?

optional linkStrengthBy: 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

Omit.linkStrengthBy


linkStrengthByFn?

optional linkStrengthByFn: 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

Omit.linkStrengthByFn


linkStrengthRange?

optional linkStrengthRange: [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 linkStrength column is provided and contains numeric values and when linkStrengthFn is not set. Has effect only during the active simulation.

Default

[0.2, 1.0]

Inherited from

Omit.linkStrengthRange


linkIncludeColumns?

optional linkIncludeColumns: 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

Omit.linkIncludeColumns


linkTargetsBy

linkTargetsBy: string[]

The column names to use as the targets for links.


outputFilename?

optional outputFilename: string

The filename to use for the output links 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.


linkColor?

optional linkColor: 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

Pick.linkColor


linkGreyoutOpacity?

optional linkGreyoutOpacity: number

Greyed out link opacity value when the selection is active. Default value: 0.1

Inherited from

Pick.linkGreyoutOpacity


linkWidth?

optional linkWidth: 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

Pick.linkWidth


linkWidthScale?

optional linkWidthScale: number

Scale factor for the link width. Default value: 1

Inherited from

Pick.linkWidthScale