import { PlotData, DifferentialPlotData } from '../plots/interfaces';
import { Scale, Domain, Tuplet } from '../common/interfaces';
export type ReducerFunction = (data: PlotData) => Tuplet<number>[];
/**
 * Various utility functions for transforming and processing
 * data sets.
 */
export default class DataHelper {
    /**
     * Reduce multiple points to the its average values.
     */
    static mean(segment: PlotData): Tuplet<number>[];
    static minmax(segment: PlotData): Tuplet<number>[];
    /**
     * Test if the data is within the scale's domain
     */
    static isWithinBounds(scale: Scale, datapoints: PlotData): boolean;
    /**
     * Remove successive entries of NULL values, leaving only the first
     * NULL value. Required by the resample function.
     */
    static trimUndefinedValues(datapoints: PlotData): PlotData;
    /**
     * Cut data points that are outside the current visible domain.
     * An excess will ensure that panning is smooth
     */
    static filterData(datapoints: PlotData, domain: Domain, overlapFactor?: number): PlotData;
    /**
     * Find the first index that has a finite numeric value
     * @param data data to search
     * @param start start index to search from
     */
    static findNextDefined(data: PlotData, start?: number): number;
    /**
     * Find the first index that has NOT a finite numeric value
     * @param data data to search
     * @param start start index to search from
     */
    static findNextUndefined(data: PlotData, start?: number): number;
    /**
     * Resample large data series to reduce detail when number of points are
     * greater than the number of pixels to render it to. NOTE: you should pass the data through
     * the DataHelper.trimUndefinedValues before passing it to this function. Also, this function
     * assumes the datapoints are more or less uniformly spaced. The DataHelper.downsample is
     * probably safer and yields better results.
     * @param datapoints data to resample
     * @param ratio resample ratio
     * @param reducer function to reduce segments
     */
    static resample(datapoints: PlotData, ratio: number, reducer?: ReducerFunction): PlotData;
    /**
     * Downsamples data by reducing segments that scales to the same approximate range
     * @param datapoints data to downsample
     * @param scale scale to control downsampling
     * @param reducer function to reduce segments
     */
    static downsample(datapoints: PlotData, scale: Scale, reducer?: ReducerFunction): PlotData;
    /**
     * Trim two data series so that it can be correlated.
     * Used in differential plot.
     */
    static mergeDataSeries(arr1: PlotData, arr2: PlotData): DifferentialPlotData;
    /**
     * In a data set of two values, return the second element
     * of the item where the first item is closest to the query
     * value. The data set is considered to be contineous rather
     * than discrete.
     */
    static queryContinuousData(queryVal: number, data: PlotData): number | null;
    /**
     * In a data set of two values, return the second element
     * of the item where the first item is closest to the query
     * value. The data set is considered to be discrete.
     */
    static queryPointData(queryVal: number, data: PlotData, threshold?: number): number | null;
    /**
     * In a data set of two values, return the second element
     * of the item where the first item is closest to the query
     * value. The data set is considered to be organized such that
     * an item is the end of the previous item and the start of the
     * next (zones).
     */
    static queryZoneData(queryVal: number, data: PlotData): number | null;
}
