import { CartesianOrientations } from "./interfaces"; import { Numeric } from "d3"; export declare namespace Tools { export const debounce: any; export const clone: any; export const merge: any; export const removeArrayDuplicates: any; export const clamp: any; export const isEqual: any; export const flatMapDeep: any; export const kebabCase: any; export const fromPairs: any; export const some: any; /** * Returns default chart options merged with provided options, * with special cases for axes. * Axes object will not merge the not provided axes. * * @export * @param {AxisChartOptions} defaultOptions Configuration.options[chartType] * @param {AxisChartOptions} providedOptions user provided options * @returns merged options */ export function mergeDefaultChartOptions(defaultOptions: any, providedOptions: any): any; /************************************** * DOM-related operations * *************************************/ /** * Get width & height of an element * * @export * @param {any} el element to get dimensions from * @returns an object containing the width and height of el */ export function getDimensions(el: any): { width: number; height: number; }; /** * Gets elements's x and y translations from transform attribute or returns null * * @param {HTMLElement} element * @returns an object containing the translated x and y values or null */ export function getTranslationValues(elementRef: HTMLElement): { tx: string; ty: string; }; /************************************** * Formatting & calculations * *************************************/ /** * Gets x and y coordinates from HTML transform attribute * * @export * @param {any} string the transform attribute string ie. transform(x,y) * @returns Returns an object with x and y offsets of the transform */ export function getTranformOffsets(string: any): { x: number; y: number; }; /** * Returns string value for height/width using pixels if there isn't a specified unit of measure * * @param value string or number value to be checked for unit of measure */ export function formatWidthHeightValues(value: any): any; /** * Capitalizes first letter of a string * * @export * @param {any} string the input string to perform first letter capitalization with * @returns The transformed string after first letter is capitalized */ export function capitalizeFirstLetter(string: any): any; /** * Get the percentage of a datapoint compared to the entire dataset. * @export * @param {any} item * @param {any} fullData * @returns The percentage in the form of a number (1 significant digit if necessary) */ export function convertValueToPercentage(item: any, fullData: any): number; /************************************** * Object/array related checks * *************************************/ /** * Compares two arrays to return the difference between two arrays' items. * * @export * @param {any[]} oldArray the array to check for missing items * @param {any[]} newArray the array to check for newly added items * @returns An object containing items missing (existing in oldArray but not newArray) * and items added (existing in newArray but not in oldArray). Object is of the form { missing: [], added: [] } */ export function arrayDifferences(oldArray: any[], newArray: any[]): { missing: any[]; added: any[]; }; /** * Gets the duplicated keys from an array of data * * @export * @param {*} data - array of data * @returns A list of the duplicated keys in data */ export function getDuplicateValues(arr: any): any[]; /** * In D3, moves an element to the front of the canvas * * @export * @param {any} element input element to moved in front * @returns The function to be used by D3 to push element to the top of the canvas */ export function moveToFront(element: any): any; /** * Gets a speicified property from within an object. * * @param object the object containing the property to retrieve * @param propPath nested properties used to extract the final property from within the object * (i.e "style", "color" would retrieve the color property from within an object that has "color" nested within "style") */ export const getProperty: (object: any, ...propPath: any[]) => any; interface SVGPathCoordinates { x0: number; x1: number; y0: number; y1: number; } export const flipSVGCoordinatesBasedOnOrientation: (verticalCoordinates: SVGPathCoordinates, orientation?: CartesianOrientations) => SVGPathCoordinates; export const generateSVGPathString: (verticalCoordinates: SVGPathCoordinates, orientation?: CartesianOrientations) => string; export function flipDomainAndRangeBasedOnOrientation(domain: D, range: R, orientation?: CartesianOrientations): [D, R] | [R, D]; export const compareNumeric: (a: Numeric, b: Numeric) => boolean; export {}; }