import { Feature } from 'geojson'; import { FeatureCollection } from 'geojson'; import { GeoJsonProperties } from 'geojson'; import { Geometry } from 'geojson'; import { MultiPolygon } from 'geojson'; import { Polygon } from 'geojson'; import { Position } from 'geojson'; import { Topology } from 'topojson-specification'; /** * Checks whether a given value is `null` or `undefined`. * * @param value - The value to check. * @returns `true` if the value is `null` or `undefined`, otherwise `false`. * * @example * checkIfNullOrUndefined(null); // true * checkIfNullOrUndefined(undefined); // true * checkIfNullOrUndefined(0); // false * checkIfNullOrUndefined(''); // false */ export declare function checkIfNullOrUndefined(value: any): boolean; /** * Converts a TopoJSON object to a GeoJSON object. * @param topoJson The TopoJSON object to convert. * @param key The key of the object to convert. * @returns The GeoJSON object. */ export declare function convertTopoJsonToGeoJson(topoJson: Topology, key?: string): FeatureCollection; export declare function convertTopoJsonUrlToGeoJson(url: string, key?: string): Promise>; declare interface CoordinatesProps { id: number; x: number; y: number; distanceFromCenter: number; } /** * Downloads CSV data as an Excel file with specified headers and column widths. * * The function converts JSON data (`csvData`) to an Excel sheet, adds headers, and applies custom column widths. * The resulting file is then downloaded using `file-saver` as an `.xlsx` file. * * @param csvData - The data to be exported as an Excel sheet, represented as an array of objects. * @param fileName - The name of the file to be downloaded (without extension). * @param headers - The headers for the Excel sheet. * @param xlsxHeader - The header data to be used for the Excel file (should match `headers`). * @param wscols - The column width configuration, where each item corresponds to a column. * * @example * const data = [{ name: 'Alice', age: 25 }, { name: 'Bob', age: 30 }]; * const headers = ['name', 'age']; * const xlsxHeader = { * name: "Full Name", * age: "Age", * }; * const columnWidths = [{ wch: 10 }, { wch: 5 }]; * excelDownload(data, 'user_data', headers, xlsxHeader, columnWidths); */ export declare const excelDownload: (csvData: any, fileName: string, headers: string[], xlsxHeader: { [key: string]: string; }, wscols: WsColInterface[]) => void; /** * Generates an embed link with custom query parameters. * @param link - The base URL. * @param params - An array of parameters to append. * @returns A URL string with encoded query parameters. */ export declare function generateEmbedLink(link: string, params: ParamsProps[]): string; /** * Generates an iframe HTML string using a base link and parameters. * @param link - The base URL. * @param params - Parameters to convert into query string. * @returns A string of iframe HTML. */ export declare function generateIframeCode(link: string, params: ParamsProps[]): string; export declare function getCentroidCoordinates(multiPolygonFeature: Feature, centerLargestPolygon?: boolean): Position; /** * Returns a set of class break values based on Jenks natural breaks algorithm. * * If the dataset has fewer unique values than the number of steps, * it pads the array and slices out the first and last to get bins. * * @param data - Array of numeric values to classify. * @param noOfSteps - Number of classification steps (breaks). * * @returns An array of bin break values between min and max (excluding them). * * @example * getJenks([1, 2, 3, 10, 20, 30], 3); // e.g., [3, 10] */ export declare function getJenks(data: (number | null | undefined)[], noOfSteps: number): number[]; /** * Returns a mean for a set of number * * @param data - Array of numeric values * * @returns A number * * @example * getMean([1, 2, 3, 10, 20, 30]); // e.g., 11.166666666666666 */ export declare function getMean(data: (number | null | undefined)[]): number; /** * Returns a mean for a set of number * * @param data - Array of numeric values * * @returns A number * * @example * getMedian([1, 2, 3, 10, 20, 30]); // e.g., 6.5 */ export declare function getMedian(data: (number | null | undefined)[]): number; /** * Returns a mode for a set of number * * @param data - Array of numeric values * * @returns A number * * @example * getMode([1, 2, 3, 10, 20, 30]); // e.g., 1 */ export declare function getMode(data: (number | null | undefined)[]): number; /** * Returns a quantile for a set of number * * @param data - Array of numeric values * @param percentile - Percentile to calculate * * @returns A number * * @example * getPercentile([1, 2, 3, 10, 20, 30], 0.5); // e.g., 6.5 */ export declare function getPercentile(data: (number | null | undefined)[], percentile: number): number; /** * Returns the value at the given percentile from a numeric dataset. * * @param data - An array of numbers to compute the percentile from. * @param percentile - The desired percentile (0–100). * @returns The value at the specified percentile. * * @example * getPercentileValue([1, 3, 5, 7, 9], 50); // 5 */ export declare function getPercentileValue(data: number[], percentile: number): number; /** * Parses query parameters from the current browser URL. * * @returns An array of objects containing each query parameter and its value. * If a value contains the `~` delimiter, it will be returned as a string array. * * - Replaces `+` with spaces and `_` with `'`. * - Splits values by `~` to support array-style data. * * @example * getQueryParamsFromLink(); */ export declare function getQueryParamsFromLink(): { param: string; value: string | string[]; }[]; export declare const getScatteredCircleCoordinates: ({ outerRadius, noOfPoints, pointRadius, innerRadius, padding, noOfTicks, random, verticalRange, horizontalRange, angleRange, }: Props) => CoordinatesProps[]; /** * Returns a standard deviation for a set of number * * @param data - Array of numeric values * * @returns A number * * @example * getStandardDeviation([1, 2, 3, 10, 20, 30]); // e.g., 11.166666666666666 */ export declare function getStandardDeviation(data: (number | null | undefined)[]): number; /** * Returns a contrasting text color (`#000` or `#fff`) based on the given background color. * * @param bgColor - A background color string in either hex (e.g., `#ffffff`) or RGB format (e.g., `rgb(255,255,255)`). * @returns `'#000'` for light backgrounds, `'#fff'` for dark backgrounds. * * @example * getTextColorBasedOnBgColor('#000000'); // "#fff" * getTextColorBasedOnBgColor('rgb(255,255,255)'); // "#000" */ export declare const getTextColorBasedOnBgColor: (bgColor: string) => "#000" | "#fff"; /** * Extracts unique values from a specified column in a CSV dataset. * * If the column contains non-object values, it extracts the unique values from that column, sorts them, and returns them. * If the column contains object values (e.g., arrays), it flattens the values before extracting and returning the unique values. * * @param csvData - The CSV dataset, represented as an array of objects. * @param column - The column name from which to extract unique values. * * @returns An array of unique values from the specified column, sorted in ascending order. * * @example * const csvData = [{ name: 'Alice' }, { name: 'Bob' }, { name: 'Alice' }]; * getUniqValue(csvData, 'name'); // Returns: ['Alice', 'Bob'] */ export declare function getUniqValue(csvData: any, column: string): (string | number)[]; /** * Returns a variance for a set of number * * @param data - Array of numeric values * * @returns A number * * @example * getVariance([1, 2, 3, 10, 20, 30]); // e.g., 11.166666666666666 */ export declare function getVariance(data: (number | null | undefined)[]): number; export declare const graphList: { graphName: string; graphID: string; availableInGriddedGraph: boolean; geoHubMapPresentation: boolean; availableInWideToLongFormat: boolean; }[]; /** * Downloads an image of a specified HTML element as a PNG file. * * Uses `modern-screenshot` to capture the content of the `node` and converts it to a downloadable PNG image. * It removes elements with the class `undp-viz-download-button` from the clone to prevent them from appearing in the screenshot. * * @param node - The HTMLElement to capture and convert into an image. * @param filename - The desired filename for the downloaded image (without extension). * * @example * const element = document.getElementById('myElement'); * imageDownload(element, 'screenshot'); */ export declare function imageDownload(node: HTMLElement, filename: string): void; export declare function numberFormattingFunction(value: number | string | undefined | null, naLabel?: string, precision?: number, prefix?: string, suffix?: string, locale?: string, padZeros?: PadZerosTypes): string; declare type PadZerosTypes = 'all' | 'decimal' | 'none'; /** * Represents a parameter to be embedded in a URL. */ declare interface ParamsProps { id: string; value: string | boolean | number | string[] | number[]; } declare interface Props { noOfPoints: number; pointRadius?: number; outerRadius?: number; innerRadius?: number; padding?: number; noOfTicks?: number; random?: () => number; verticalRange?: [number, number]; horizontalRange?: [number, number]; angleRange?: [number, number]; } /** * Removes statistical outliers from a numeric dataset based on standard deviation. * * @param data - The array of numbers to filter. * @param outlierThreshold - Optional multiplier for standard deviation (default: 2). * Values further than `threshold * stdDev` from the mean are considered outliers. * * @returns A filtered array with outliers removed. * * @example * removeOutliers([1, 2, 3, 100]); // [1, 2, 3] * removeOutliers([10, 12, 11, 13, 300], 1.5); // May remove 300 */ export declare function removeOutliers(data: number[], outlierThreshold?: number): number[]; /** * Downloads an SVG representation of a specified HTML element. * * Converts the HTML element into an SVG format using the `dom-to-svg` library, serializes it to a string, * and creates a downloadable `.svg` file. * * @param node - The HTMLElement to convert to SVG and download. * @param filename - The desired filename for the downloaded SVG file (without extension). * * @example * const element = document.getElementById('myElement'); * svgDownload(element, 'downloaded-svg'); */ export declare function svgDownload(node: HTMLElement, filename: string): void; declare interface WsColInterface { wch: number; } export { }