package.dist.tools.d.ts Maven / Gradle / Ivy
import { Numeric } from 'd3';
import { CartesianOrientations } from './interfaces/enums';
export declare function debounceWithD3MousePosition(fn: any, delay: number, holder: any): (...args: any) => void;
/**
* 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 declare 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 declare function getDimensions(el: any): {
width: number;
height: number;
};
/**
* Gets elements' x and y translations from transform attribute or returns null
*
* @param {HTMLElement} elementRef
* @returns an object containing the translated x and y values or null
*/
export declare function getTranslationValues(elementRef: HTMLElement): {
tx: string;
ty: string;
};
/**************************************
* Formatting & calculations *
*************************************/
/**
* Gets x and y coordinates from HTML transform attribute
*
* @export
* @param transform string the transform attribute string ie. transform(x,y)
* @returns Returns an object with x and y offsets of the transform
*/
export declare function getTransformOffsets(transform: string): {
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 declare function formatWidthHeightValues(value: string | number): string;
/**
* Capitalizes first letter of a string
*
* @export
* @param {any} word the input string to perform first letter capitalization with
* @returns The transformed string after first letter is capitalized
*/
export declare function capitalizeFirstLetter(word: string): string;
/**
* Get the percentage of a datapoint compared to the entire dataset.
* @export
* @param {any} item
* @param {any} fullData
* @param {string} key
* @returns The percentage in the form of a number (1 significant digit if necessary)
*/
export declare function convertValueToPercentage(item: any, fullData: any, key?: string, entireValue?: boolean): number;
/**
* Truncate the labels
* @export
* @param {any} fullText
* @param {any} truncationType
* @param {any} numCharacter
* @returns Truncated text
*/
export declare function truncateLabel(fullText: any, truncationType: any, numCharacter: any): any;
/**
* Update legend additional items
* @param {any} defaultOptions
* @param {any} providedOptions
*/
export declare function updateLegendAdditionalItems(defaultOptions: any, providedOptions: any): void;
/**************************************
* 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 declare function arrayDifferences(oldArray: any[], newArray: any[]): {
missing: any[];
added: any[];
};
/**
* Gets the duplicated keys from an array of data
*
* @export
* @param {*} arr - array of data
* @returns A list of the duplicated keys in data
*/
export declare 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 declare 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 declare const getProperty: (object: any, ...propPath: any) => any;
interface SVGPathCoordinates {
x0: number;
x1: number;
y0: number;
y1: number;
}
export declare const flipSVGCoordinatesBasedOnOrientation: (verticalCoordinates: SVGPathCoordinates, orientation?: CartesianOrientations) => SVGPathCoordinates;
export declare const generateSVGPathString: (verticalCoordinates: SVGPathCoordinates, orientation?: CartesianOrientations) => string;
export declare function flipDomainAndRangeBasedOnOrientation(domain: D, range: R, orientation?: CartesianOrientations): [
D,
R
] | [
R,
D
];
export declare const compareNumeric: (a: Numeric, b: Numeric) => boolean;
export {};
© 2015 - 2024 Weber Informatics LLC | Privacy Policy