@nova-ui/charts
Version:
Nova Charts is a library created to provide potential consumers with solutions for various data visualizations that conform with the Nova Design Language. It's designed to solve common patterns identified by UX designers, but also be very flexible so that
54 lines (53 loc) • 1.98 kB
TypeScript
import { IInteractionValues } from "../plugins/types";
import { IScale } from "./scales/types";
export declare class UtilityService {
private static getValueAccessor;
static getClosestIndex<T>(haystack: T[], accessor: (d: T, i: number) => any, needle: any): number | undefined;
private static getCloser;
/**
* Clamps given value to range
*
* @param {number} value
* @param {[number , number]} range
* @returns {number}
*/
static clampToRange(value: number, range: [number, number]): number;
static uuid(): string;
/**
* CSS.escape() replacement
* @param value
* @returns {string}
*/
static cssEscape(value: any): string;
/**
* This method performs a binary search to find an index in the `haystack` that is the closest representation of given `needle`.
*
* @param haystack
* @param needle
* @param selector this function is used to process the `haystack` elements
*/
static findNearestIndex<T>(haystack: T[], needle: any, selector?: (d: T, index: number) => any): number;
/**
* Gets the 'x' and 'y' scale values based on the specified scales and raw x-y coordinates
*
* @param xScales
* @param yScales
* @param xCoordinate
* @param yCoordinate
*/
static getXYValues(xScales: IScale<any>[], yScales: IScale<any>[], xCoordinate: number, yCoordinate: number): IInteractionValues;
/**
* Gets the scale value based on the specified scales and raw coordinate
*
* @param scales
* @param coordinate
*/
static getScaleValues(scales: IScale<any>[], coordinate: number): Record<string, any>;
/**
* get values for interaction
* @param valueMap map of values by scaleId
* @param scaleId preferred scaleId
* @returns value from scaleId or first availabel scale
*/
static getInteractionValues(valueMap: Record<string, any> | null | undefined, scaleId: string): any;
}