import { CosmographConfig } from ".."; import { CosmographCustomLabel } from "../../modules/labels"; import { AccessorFn } from './data'; export declare const LabelsKeys: { readonly ShowLabels: "showLabels"; readonly ShowDynamicLabels: "showDynamicLabels"; readonly ShowDynamicLabelsLimit: "showDynamicLabelsLimit"; readonly ShowTopLabels: "showTopLabels"; readonly ShowTopLabelsLimit: "showTopLabelsLimit"; readonly ShowLabelsFor: "showLabelsFor"; readonly ShowFocusedPointLabel: "showFocusedPointLabel"; readonly ShowClusterLabels: "showClusterLabels"; readonly ShowClusterLabelsLimit: "showClusterLabelsLimit"; readonly ShowUnselectedPointLabels: "showUnselectedPointLabels"; readonly ShowSelectedLabels: "showSelectedLabels"; readonly SelectedPointLabelsLimit: "selectedPointLabelsLimit"; readonly PointLabelClassName: "pointLabelClassName"; readonly PointLabelFn: "pointLabelFn"; readonly PointLabelWeightFn: "pointLabelWeightFn"; readonly PointLabelColor: "pointLabelColor"; readonly PointLabelFontSize: "pointLabelFontSize"; readonly ClusterLabelFontSize: "clusterLabelFontSize"; readonly ClusterLabelClassName: "clusterLabelClassName"; readonly ScaleClusterLabels: "scaleClusterLabels"; readonly UsePointColorStrategyForClusterLabels: "usePointColorStrategyForClusterLabels"; readonly StaticLabelWeight: "staticLabelWeight"; readonly DynamicLabelWeight: "dynamicLabelWeight"; readonly LabelMargin: "labelMargin"; readonly LabelPadding: "labelPadding"; readonly CustomLabels: "customLabels"; }; export declare const HoveredLabelsKeys: { readonly ShowHoveredPointLabel: "showHoveredPointLabel"; readonly HoveredPointLabelClassName: "hoveredPointLabelClassName"; }; export interface LabelsCosmographConfig { /** * Whether to show labels (except hovered) on the Cosmograph canvas. When `true`, labels are visible only if {@link CosmographConfig.pointLabelBy pointLabelBy} is provided. * Default: `false` */ [LabelsKeys.ShowLabels]?: boolean; /** * Show automatic labels for the evenly distributed points that are currently visible on the screen. * * Works only when {@link CosmographConfig.pointLabelBy pointLabelBy} is provided. * Default: `true` */ [LabelsKeys.ShowDynamicLabels]?: boolean; /** * Maximum number of dynamic labels to show. * Default: `30` */ [LabelsKeys.ShowDynamicLabelsLimit]?: number; /** * An array of point ids to show labels for. * * Works only when {@link CosmographConfig.pointLabelBy pointLabelBy} is provided. * Default: `undefined` */ [LabelsKeys.ShowLabelsFor]?: string[]; /** * Whether to show label for the focused point. * Default: `true` */ [LabelsKeys.ShowFocusedPointLabel]?: boolean; /** * Show labels for the top points. * Works only when {@link CosmographConfig.pointLabelBy pointLabelBy} is provided. * Default: `true` */ [LabelsKeys.ShowTopLabels]?: boolean; /** * Sets the maximum number of top points to show labels for. * Default: `30` */ [LabelsKeys.ShowTopLabelsLimit]?: number; /** * Show labels for the clusters based on the {@link CosmographConfig.pointClusterBy 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 {@link CosmographConfig.pointClusterBy pointClusterBy} is provided. * Default: `false` */ [LabelsKeys.ShowClusterLabels]?: boolean; /** * Maximum number of cluster labels to render. * Default: `500` */ [LabelsKeys.ShowClusterLabelsLimit]?: number; /** * When `true`, shows labels for unselected points during filtering/selection. * When `false`, hides unselected labels, allocating more visual space for selected point labels. * Default: `true` */ [LabelsKeys.ShowUnselectedPointLabels]?: boolean; /** * When `true`, shows labels for selected points when filtering/selection is active. * When `false`, selected point labels are hidden. * Default: `true` */ [LabelsKeys.ShowSelectedLabels]?: boolean; /** * Maximum number of labels to show for selected points. When selection is active and {@link CosmographConfig.showUnselectedPointLabels showUnselectedPointLabels} is `false`, * this limit is used instead of {@link CosmographConfig.showTopLabelsLimit showTopLabelsLimit}. * Default: `100` */ [LabelsKeys.SelectedPointLabelsLimit]?: number; /** * Specifies the CSS color to use for the point labels. * * If `undefined`, label will be colored as point. */ [LabelsKeys.PointLabelColor]?: string; /** * Specifies the font size to use for the point labels. * * @default: 13 */ [LabelsKeys.PointLabelFontSize]?: number; /** * Specifies the font size to use for the cluster labels. If {@link CosmographConfig.scaleClusterLabels 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 */ [LabelsKeys.ClusterLabelFontSize]?: number; /** * Specifies the CSS class to use for the cluster labels. * * @param {string} text - The text of the label. * @param {number} clusterIndex - The index of the cluster. * @returns {string} The CSS class/string to be applied to the cluster label. * @default: `'background: #35374887; font-weight: 300; opacity: 0.9;'` */ [LabelsKeys.ClusterLabelClassName]?: string | ((text: string, clusterIndex: number) => string); /** * Whether to scale the cluster labels based on the number of points in the cluster. * Default: `true` */ [LabelsKeys.ScaleClusterLabels]?: boolean; /** * If `true`, cluster labels will acquire colors from the current point coloring strategy ({@link CosmographConfig.pointColorStrategy pointColorStrategy}). * This can be useful when {@link CosmographConfig.pointClusterBy pointClusterBy} and {@link CosmographConfig.pointColorBy pointColorBy} refer to the same data. * Default: `false` */ [LabelsKeys.UsePointColorStrategyForClusterLabels]?: boolean; /** * Specifies the function that will be used to generate the labels based on {@link CosmographConfig.pointLabelBy pointLabelBy} column. It should return a `string`. * * Works only when {@link CosmographConfig.pointLabelBy pointLabelBy} is provided. Overrides the values specified in {@link CosmographConfig.pointLabelBy pointLabelBy} column by processing them. * * @param value - The value from the {@link CosmographConfig.pointLabelBy pointLabelBy} column. * @param index - The index of the point. * @returns Text of label. */ [LabelsKeys.PointLabelFn]?: AccessorFn; /** * Specifies the function that will be used to generate the label weights. Should return a `number` between 0 and 1. * * Works only when {@link CosmographConfig.pointLabelWeightBy pointLabelWeightBy} is provided. Overrides the values specified in {@link CosmographConfig.pointLabelWeightBy pointLabelWeightBy} column by processing them. * * @param {any} value - Value from the {@link CosmographConfig.pointLabelWeightBy pointLabelWeightBy} column. * @param {number} index - Index of the point. * @returns {number} Label weight value to be applied to the point label. */ [LabelsKeys.PointLabelWeightFn]?: AccessorFn; /** * 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 {string} text - The text of the label. * @param {number} pointIndexBy - The index of the point. * @param {string} [pointIdBy] - The optional ID of the point. * @returns {string} CSS class name to be applied to the point label. */ [LabelsKeys.PointLabelClassName]?: string | ((text: string, pointIndexBy: number, pointIdBy?: string) => string); /** * Specifies the weight of the static labels. * Default: `0.8` */ [LabelsKeys.StaticLabelWeight]?: number; /** * Specifies the weight of the dynamic labels. * Default: `0.7` */ [LabelsKeys.DynamicLabelWeight]?: number; /** * Specifies the margin between the label and the point. * Default: `5` */ [LabelsKeys.LabelMargin]?: number; /** * Specifies the [left, top, right, bottom] padding of the label element. * Default: `[6.5, 4.5, 6.5, 4.5]` */ [LabelsKeys.LabelPadding]?: [number, number, number, number]; /** * 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. */ [LabelsKeys.CustomLabels]?: CosmographCustomLabel[]; /** * Whether to show a hovered point label. * Default: `false` */ [HoveredLabelsKeys.ShowHoveredPointLabel]?: boolean; /** * 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 {number} pointIndexBy - The index of the point. * @param {string} [pointIdBy] - The optional ID of the point. * @returns {string} The CSS class to be applied to the point label. */ [HoveredLabelsKeys.HoveredPointLabelClassName]?: string | ((text: string, pointIndexBy: number, pointIdBy?: string) => string); } export declare const labelsUpdateKeys: Array;