import { type UnionValue, type ArrayUnion } from '../../treb-base-types/src/index'; import type { SeriesType, ChartData } from './chart-types'; import type { ReferenceSeries } from './chart-types'; import type { RangeScale } from '../../treb-utils/src/index'; export declare const ArrayMinMax: (data: number[]) => { min: number; max: number; }; export declare const ReadSeries: (data: ReferenceSeries["value"]) => SeriesType; export declare const ArrayToSeries: (array_data: ArrayUnion) => SeriesType; /** * composite data -> series. composite data can be * * (1) set of Y values, with X not provided; * (2) SERIES(label, X, Y) with Y required, others optional * (3) GROUP(a, b, ...), where entries are either arrays as (1) or SERIES as (2) * * FIXME: consider supporting GROUP(SERIES, [y], ...) * * NOTE: (1) could be an array of boxed (union) values... * */ export declare const TransformSeriesData: (raw_data?: UnionValue, default_x?: UnionValue) => SeriesType[]; /** get a unified scale, and formats */ export declare const CommonData: (series: SeriesType[], y_floor?: number, y_ceiling?: number, x_floor?: number, x_ceiling?: number, auto_number_format?: boolean) => { legend?: { label: string; index?: number; }[]; x: { format: string; scale: RangeScale; labels?: string[]; }; y: { format: string; scale: RangeScale; labels?: string[]; }; y2?: { format: string; scale: RangeScale; labels?: string[]; }; }; /** * return quartiles. we use the Tukey hinge-style. See * * https://en.wikipedia.org/wiki/Quartile * * Specifically, * * - Use the median to divide the ordered data set into two halves. The median * becomes the second quartiles. * * - If there are an odd number of data points in the original ordered data * set, include the median (the central value in the ordered list) in both * halves. * * - If there are an even number of data points in the original ordered data * set, split this data set exactly in half. * * - The lower quartile value is the median of the lower half of the data. The * upper quartile value is the median of the upper half of the data. * * @param data - must be sorted with no holes */ export declare const BoxStats: (data: number[]) => { data: number[]; quartiles: [number, number, number]; whiskers: [number, number]; iqr: number; n: number; mean: number; min: number; max: number; }; export declare const CreateBoxPlot: (args: UnionValue[]) => ChartData; export declare const CreateBubbleChart: (args: UnionValue[]) => ChartData; /** * args is [data, title, options] * * args[0] is the scatter data. this can be * * (1) set of Y values, with X not provided; * (2) SERIES(label, X, Y) with Y required, others optional * (3) GROUP(SERIES(label, X, Y), SERIES(label, X, Y), ...), with same rule for each series * * @param args */ export declare const CreateScatterChart: (args: [UnionValue, string, string], style?: "plot" | "line") => ChartData; /** * column/bar chart, now using common Series data and routines * * @param args arguments: data, categories, title, options * @param type */ export declare const CreateColumnChart: (args: [UnionValue?, UnionValue?, string?, string?], type: "bar" | "column") => ChartData; /** * args: data, labels, title, callouts, "smooth" */ export declare const CreateLineChart: (args: [UnionValue, UnionValue, string, string], type: "line" | "area") => ChartData; /** * arguments are values, labels, title, sort, label option, ... */ export declare const CreateDonut: (args: [UnionValue?, UnionValue?, string?, string?, string?], pie_chart?: boolean) => ChartData;