Interface: LabelsCosmographConfig
Extended by
Properties
showLabels?
optionalshowLabels:boolean
Whether to show labels (except hovered) on the Cosmograph canvas. When true, labels are visible only if pointLabelBy is provided.
Default: false
showDynamicLabels?
optionalshowDynamicLabels:boolean
Show automatic labels for the evenly distributed points that are currently visible on the screen.
Works only when pointLabelBy is provided.
Default: true
showLabelsFor?
optionalshowLabelsFor:string[]
An array of point ids to show labels for.
Works only when pointLabelBy is provided.
Default: undefined
showTopLabels?
optionalshowTopLabels:boolean
Show labels for the top points.
Works only when pointLabelBy is provided.
Default: true
showTopLabelsLimit?
optionalshowTopLabelsLimit:number
Sets the maximum number of top points to show labels for.
Default: 30
showClusterLabels?
optionalshowClusterLabels:boolean
Show labels for the clusters based on the pointClusterBy column. Will take priority over point labels. When any point is selected, cluster labels will be hidden until the selection is cleared.
Has effect only when pointClusterBy is provided.
Default: false
pointLabelColor?
optionalpointLabelColor:string
Specifies the CSS color to use for the point labels.
If undefined, label will be colored as point.
pointLabelFontSize?
optionalpointLabelFontSize:number
Specifies the font size to use for the point labels.
@default: 13
clusterLabelFontSize?
optionalclusterLabelFontSize:number
Specifies the font size to use for the cluster labels. If scaleClusterLabels is true (by default), the font size will be scaled based on the number of points in the cluster and the clusterLabelFontSize will be used as the baseline.
@default: 16
clusterLabelClassName?
optionalclusterLabelClassName:string| (text,clusterIndex) =>string
Specifies the CSS class to use for the cluster labels.
Param
The text of the label.
Param
The index of the cluster.
Returns
The CSS class/string to be applied to the cluster label.
@default: 'background: #35374887; font-weight: 300; opacity: 0.9;'
scaleClusterLabels?
optionalscaleClusterLabels:boolean
Whether to scale the cluster labels based on the number of points in the cluster.
Default: true
usePointColorStrategyForClusterLabels?
optionalusePointColorStrategyForClusterLabels:boolean
If true, cluster labels will acquire colors from the current point coloring strategy (pointColorStrategy).
This can be useful when pointClusterBy and pointColorBy refer to the same data.
Default: false
pointLabelFn()?
optionalpointLabelFn: (value,index?) =>string
Specifies the function that will be used to generate the labels based on pointLabelBy column. It should return a string.
Works only when pointLabelBy is provided. Overrides the values specified in pointLabelBy column by processing them.
Parameters
| Parameter | Type | Description | 
|---|---|---|
value | unknown | The value from the pointLabelBy column. | 
index? | number | The index of the point. | 
Returns
string
Text of label.
pointLabelWeightFn()?
optionalpointLabelWeightFn: (value,index?) =>number
Specifies the function that will be used to generate the label weights. Should return a number between 0 and 1.
Works only when pointLabelWeightBy is provided. Overrides the values specified in pointLabelWeightBy column by processing them.
Parameters
| Parameter | Type | Description | 
|---|---|---|
value | unknown | Value from the pointLabelWeightBy column. | 
index? | number | Index of the point. | 
Returns
number
Label weight value to be applied to the point label.
pointLabelClassName?
optionalpointLabelClassName:string| (text,pointIndexBy,pointIdBy?) =>string
Specifies the CSS class to use for the point labels. This can either be a string specifying a fixed CSS class name or a function that returns a CSS class name based on the point index and optional point ID.
Remarks
When provided as a function, accepts:
Param
The text of the label.
Param
The index of the point.
Param
The optional ID of the point.
Returns
CSS class name to be applied to the point label.
staticLabelWeight?
optionalstaticLabelWeight:number
Specifies the weight of the static labels.
Default: 0.8
dynamicLabelWeight?
optionaldynamicLabelWeight:number
Specifies the weight of the dynamic labels.
Default: 0.7
labelMargin?
optionallabelMargin:number
Specifies the margin between the label and the point.
Default: 5
labelPadding?
optionallabelPadding: [number,number,number,number]
Specifies the [left, top, right, bottom] padding of the label element.
Default: [6.5, 4.5, 6.5, 4.5]
customLabels?
optionalcustomLabels:CosmographCustomLabel[]
Specifies an array of custom labels to be displayed on the Cosmograph canvas.
Each custom label is defined by the CosmographCustomLabel type, which includes properties for the label text, position, weight and optional CSS class.
showHoveredPointLabel?
optionalshowHoveredPointLabel:boolean
Whether to show a hovered point label.
Default: false
hoveredPointLabelClassName?
optionalhoveredPointLabelClassName:string| (text,pointIndexBy,pointIdBy?) =>string
Specifies the CSS class to use for the hovered point label. This can either be a string specifying a fixed CSS class name or a function that returns a CSS class name based on the point index and optional point ID.
Param
The index of the point.
Param
The optional ID of the point.
Returns
The CSS class to be applied to the point label.