import { DataType } from 'apache-arrow'; import { CosmographConfig } from ".."; import { ColorAccessorFn } from "../config/interfaces/data"; export declare enum PointColorStrategy { /** * Uses colors from {@link CosmographConfig.pointColorPalette pointColorPalette} for {@link CosmographConfig.pointColorBy pointColorBy} data without interpolation. * - For numeric data: Creates equal-width buckets mapped to {@link CosmographConfig.pointColorPalette pointColorPalette} colors * - For categorical data: Assigns colors from {@link CosmographConfig.pointColorPalette pointColorPalette} in order, cycling when unique values exceed palette length * - Uses {@link CosmographConfig.unknownColor unknownColor} for nullish values * - Has effect only if {@link CosmographConfig.pointColorBy pointColorBy} provided. */ Categorical = "categorical", /** * Interpolates colors from {@link CosmographConfig.pointColorPalette pointColorPalette} over {@link CosmographConfig.pointColorBy pointColorBy} data. * - For numeric data: Creates continuous color scale between {@link CosmographConfig.pointColorPalette pointColorPalette} colors * - For categorical data: Creates evenly-spaced color scale by interpolating between {@link CosmographConfig.pointColorPalette pointColorPalette} colors to match the number of unique values in {@link CosmographConfig.pointColorBy pointColorBy} so every value is a unique color. * - Uses {@link CosmographConfig.unknownColor unknownColor} for nullish values * - Has effect only if {@link CosmographConfig.pointColorBy pointColorBy} provided. */ Continuous = "continuous", /** * Uses color mapping from {@link CosmographConfig.pointColorByMap pointColorByMap} to values in {@link CosmographConfig.pointColorBy pointColorBy}. * - Applies exact color from {@link CosmographConfig.pointColorByMap CosmographConfig.pointColorByMap} for matching values * - Falls back to {@link CosmographConfig.unknownColor unknownColor} when value is not found in map or invalid * - Has effect only if {@link CosmographConfig.pointColorByMap pointColorByMap} and {@link CosmographConfig.pointColorBy pointColorBy} provided */ Map = "map", /** * Colors points based on their degree (number of connections) using interpolated {@link CosmographConfig.pointColorPalette pointColorPalette} with quantile-based boundaries. * - Maps point degrees to continuous color scale between {@link CosmographConfig.pointColorPalette pointColorPalette} colors * - Minimum and maximum values are clamped to 5th and 95th percentiles of total degree distribution * - Has effect only if links provided */ Degree = "degree", /** * Colors points based on their degree (number of connections) using interpolated {@link CosmographConfig.pointColorPalette pointColorPalette} without quantile-based boundaries. * - Maps point degrees to continuous color scale between {@link CosmographConfig.pointColorPalette pointColorPalette} colors * - Has effect only if links provided */ PreciseDegree = "preciseDegree", /** * Colors points based on their link direction using {@link CosmographConfig.pointColorPalette pointColorPalette}. * - Has effect only if links provided */ LinkDirection = "linkDirection", /** * Directly uses {@link CosmographConfig.pointColorBy 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 {@link CosmographConfig.pointColorByFn pointColorByFn} exists, applies it to transform {@link CosmographConfig.pointColorBy pointColorBy} values into custom colors with it * - Falls back to {@link CosmographConfig.unknownColor unknownColor} if invalid color * - If neither {@link CosmographConfig.pointColorBy} nor {@link CosmographConfig.pointColorByFn} exist, colors all points with {@link CosmographConfig.unknownColor unknownColor} */ Direct = "direct", /** * Colors all points uniformly to the same color specified by {@link CosmographConfig.pointDefaultColor pointDefaultColor}. */ Single = "single" } export type PointColorStrategyType = `${PointColorStrategy}`; /** * Determines the optimal color strategy for points based on the input configuration and color data type. * * @param config - The configuration object of the Cosmograph. * @param pointsSummary - Optional summaries of points. * @returns The resolved {@link PointColorStrategyType} */ export declare function resolveOptimalPointColorStrategy(config?: CosmographConfig, dataColumnType?: DataType): PointColorStrategyType; /** * Determines the appropriate color accessor function based on the provided configuration and data. * * @param config - The configuration object of the Cosmograph. * @param data - The data array to be used for color scaling. * @param dataColumnType - The data type of the column being colored (optional). * @returns A color accessor function that can be used to determine the color of points. */ export declare const getActivePointColorFn: (strategy: PointColorStrategyType, config: CosmographConfig, data: string[] | number[], dataColumnType?: DataType) => ColorAccessorFn;