UNPKG

reaviz

Version:

Data Visualization using React

44 lines (43 loc) 2.39 kB
export type ColorSchemeType = ((data: any, index: number, active?: any[]) => string) | string[] | string; export type ColorSchemeStyleArray = Partial<CSSStyleDeclaration>[]; type ColorHelperProps = { colorScheme: ColorSchemeType; point: any; data: any[]; index: number; active: any[]; scale?: any; domain?: any[]; key?: any; attribute?: string; isMultiSeries?: boolean; }; type ColorSchemeValueScale = (point: any) => string; /** * Get a color given a range. */ export declare const getColor: (props: Partial<ColorHelperProps>) => any; /** * This function generates a style object for a given data point based on a map of value scales. * * @param {any} point - The data point for which to generate the style object. * @param {Map<string, ColorSchemeValueScale>} valueScales - A map where each key is a property name and each value is a function that takes a data point and returns a CSS style. * * @returns {Partial<CSSStyleDeclaration>} A style object where each key is a property name and each value is a color or CSS style based on the value of the data point for that property. */ export declare const getColorSchemeStyles: (point: any, valueScales: Map<string, ColorSchemeValueScale>) => Partial<CSSStyleDeclaration>; /** * This function creates a map of value scales for different properties based on a provided color scheme. * Each value scale is a function that takes a data point and returns a css style value based on that point. * * @param {Array} data - The data used to create the scales. * @param {ColorSchemeType | ColorSchemeStyleArray} colorScheme - The color scheme used to generate the scales. This can be an array of colors or an array of objects where each object contains a set of css styles. * @param {string} emptyColor - The color used for data points with no value. * @param {any} selections - Selected values in active state * * @returns {Map<string, ColorSchemeValueScale>} A map where each key is a property name and each value is a function that takes a data point and returns a value for the property. * * If the color scheme is an array of strings, they will be treated as fill values. */ export declare const createColorSchemeValueScales: (data: any, colorScheme: ColorSchemeType | ColorSchemeStyleArray, emptyColor: string, selections: any) => Map<string, ColorSchemeValueScale>; export {};